JBoss Tools SVN: r36990 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2011-12-06 06:11:55 -0500 (Tue, 06 Dec 2011)
New Revision: 36990
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
Log:
JBIDE-10354: add openshift profile template to pom.xml editor
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2011-12-06 11:07:18 UTC (rev 36989)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2011-12-06 11:11:55 UTC (rev 36990)
@@ -62,7 +62,7 @@
<extension
point="org.eclipse.wst.server.core.serverTypes">
<serverType
- behaviourClass="org.jboss.tools.openshift.express.internal.core.behaviour.ExpressBehaviour"
+ behaviourClass="org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior"
class="org.jboss.ide.eclipse.as.core.server.internal.JBossServer"
name="%openshift.express.name"
description="%openshift.express.description"
@@ -212,5 +212,31 @@
type="org.eclipse.ui.console.MessageConsole">
</propertyTester>
</extension>
-
+
+ <extension point="org.eclipse.ui.editors.templates">
+ <template id="org.jboss.tools.maven.editor.xml.templates.profiles.openshift"
+ contextTypeId="org.eclipse.m2e.editor.xml.templates.contextType.profiles"
+ name="OpenShift Express profile"
+ description="OpenShift Express profile">
+ <pattern> <profile>
+ <!-- When built in OpenShift the 'openshift' profile will be used when invoking mvn. -->
+ <!-- Use this profile for any OpenShift specific customization your app will need. -->
+ <!-- By default that is to put the resulting archive into the 'deployments' folder. -->
+ <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environm... -->
+ <id>openshift</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.1.1</version>
+ <configuration>
+ <outputDirectory>deployments</outputDirectory>
+ <warName>ROOT</warName>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</profile></pattern>
+ </template>
+ </extension>
</plugin>
14 years
JBoss Tools SVN: r36989 - in trunk: as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-12-06 06:07:18 -0500 (Tue, 06 Dec 2011)
New Revision: 36989
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractBehaviourDelegate.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviour.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethod.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossBehaviourDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviourDelegate.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java
Log:
JBIDE-10355 to trunk - openshift publish usability
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethod.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethod.java 2011-12-06 11:04:27 UTC (rev 36988)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethod.java 2011-12-06 11:07:18 UTC (rev 36989)
@@ -22,6 +22,17 @@
// public IJBossServerPublishMethodType getPublishMethodType();
public void publishStart(DeployableServerBehavior behaviour, IProgressMonitor monitor) throws CoreException;
public int publishFinish(DeployableServerBehavior behaviour, IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Publish this module
+ * @param behaviour The behaviour associated with this server
+ * @param kind The kind of publish, as a constant from IServer
+ * @param deltaKind The kind of delta, as a constant from ServerBehaviourDelegate
+ * @param module The module to be published
+ * @param monitor The progress monitor
+ * @return An IServer.STATE_XXX constant, or -1 if the behaviour should not change server state
+ * @throws CoreException
+ */
public int publishModule(DeployableServerBehavior behaviour, int kind, int deltaKind, IModule[] module, IProgressMonitor monitor) throws CoreException;
// Methods moved from publishers into the publish method
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractBehaviourDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractBehaviourDelegate.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractBehaviourDelegate.java 2011-12-06 11:07:18 UTC (rev 36989)
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.server.internal;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * A complete stub implementation of the interface
+ */
+public abstract class AbstractBehaviourDelegate implements IJBossBehaviourDelegate {
+
+ protected DelegatingServerBehavior actualBehavior;
+
+ @Override
+ public void setActualBehaviour(DelegatingServerBehavior actualBehaviour) {
+ this.actualBehavior = actualBehaviour;
+ }
+
+ @Override
+ public String getBehaviourTypeId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void stop(boolean force) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void publishStart(IProgressMonitor monitor) throws CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void publishFinish(IProgressMonitor monitor) throws CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onServerStarting() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onServerStopping() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onServerStarted() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onServerStopped() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public IStatus canChangeState(String launchMode) {
+ // TODO Auto-generated method stub
+ return Status.CANCEL_STATUS;
+ }
+
+ @Override
+ public String getDefaultStopArguments() throws CoreException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossBehaviourDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossBehaviourDelegate.java 2011-12-06 11:04:27 UTC (rev 36988)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossBehaviourDelegate.java 2011-12-06 11:07:18 UTC (rev 36989)
@@ -11,7 +11,6 @@
package org.jboss.ide.eclipse.as.core.server.internal;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.wst.server.core.IServer;
@@ -23,28 +22,14 @@
import org.jboss.ide.eclipse.as.core.util.PollThreadUtils;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
-public abstract class AbstractJBossBehaviourDelegate implements IJBossBehaviourDelegate {
+public abstract class AbstractJBossBehaviourDelegate extends AbstractBehaviourDelegate {
- private DelegatingServerBehavior actualBehavior;
private PollThread pollThread = null;
- @Override
- public void setActualBehaviour(DelegatingServerBehavior actualBehaviour) {
- this.actualBehavior = actualBehaviour;
- }
-
public IServer getServer() {
return actualBehavior.getServer();
}
- @Override
- public void publishStart(IProgressMonitor monitor) throws CoreException {
- }
-
- @Override
- public void publishFinish(IProgressMonitor monitor) throws CoreException {
- }
-
public void stop(boolean force) {
if( LaunchCommandPreferences.isIgnoreLaunchCommand(getServer())) {
actualBehavior.setServerStopped();
@@ -59,18 +44,6 @@
protected abstract IStatus gracefullStop();
- public void onServerStarting() {
- }
-
- public void onServerStopping() {
- }
-
- public void onServerStarted() {
- }
-
- public void onServerStopped() {
- }
-
@Override
public IStatus canChangeState(String launchMode) {
return Status.OK_STATUS;
@@ -157,9 +130,4 @@
protected void setServerStarting() {
actualBehavior.setServerStarting();
}
-
- @Override
- public void dispose() {
- // do nothing
- }
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2011-12-06 11:04:27 UTC (rev 36988)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2011-12-06 11:07:18 UTC (rev 36989)
@@ -90,8 +90,10 @@
throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, "Not publishing")); //$NON-NLS-1$
try {
int result = method.publishModule(this, kind, deltaKind, module, monitor);
- setModulePublishState(module, result);
- setModuleState(module, IServer.STATE_STARTED );
+ if( result != -1 ) {
+ setModulePublishState(module, result);
+ setModuleState(module, IServer.STATE_STARTED );
+ }
} catch(CoreException ce) {
setModulePublishState(module, IServer.PUBLISH_STATE_FULL);
setModuleState(module, IServer.STATE_UNKNOWN );
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java 2011-12-06 11:04:27 UTC (rev 36988)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ModuleActionProvider.java 2011-12-06 11:07:18 UTC (rev 36989)
@@ -4,6 +4,7 @@
import java.util.Iterator;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IContributionItem;
@@ -22,13 +23,12 @@
import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.internal.PublishServerJob;
import org.eclipse.wst.server.core.internal.Server;
import org.eclipse.wst.server.ui.internal.cnf.ServerActionProvider;
import org.eclipse.wst.server.ui.internal.view.servers.ModuleServer;
-import org.jboss.ide.eclipse.as.core.util.ModuleUtil;
import org.jboss.ide.eclipse.as.ui.JBossServerUISharedImages;
import org.jboss.ide.eclipse.as.ui.Messages;
+import org.jboss.ide.eclipse.as.wtp.core.util.ServerModelUtilities;
public class ModuleActionProvider extends CommonActionProvider {
private Action deleteModuleAction, fullPublishModuleAction, incrementalPublishModuleAction;
@@ -126,12 +126,12 @@
for( int i = 0; i < selection.length; i++ ) {
IModule[] mod = selection[i].module;
s.setModulePublishState(mod, type);
- ArrayList<IModule[]> allChildren = ModuleUtil.getDeepChildren(s, mod);
+ ArrayList<IModule[]> allChildren = ServerModelUtilities.getDeepChildren(s, mod);
for( int j = 0; j < allChildren.size(); j++ ) {
s.setModulePublishState((IModule[])allChildren.get(j), type);
}
}
- new PublishServerJob(s, IServer.PUBLISH_INCREMENTAL, true).schedule();
+ s.publish(IServer.PUBLISH_INCREMENTAL, null, getUserInitiatedAdaptable(), null);
}
}
@@ -152,7 +152,7 @@
(IModule[]) topModsToRemove.toArray(new IModule[topModsToRemove.size()]);
ServerUtil.modifyModules(serverWC, new IModule[0], modsToRemove, new NullProgressMonitor());
IServer server2 = serverWC.save(true, null);
- new PublishServerJob(server2, IServer.PUBLISH_INCREMENTAL, true).schedule();
+ server2.publish(IServer.PUBLISH_INCREMENTAL, null, getUserInitiatedAdaptable(), null);
}
} catch (CoreException e) {
// ignore
@@ -161,4 +161,15 @@
t.start();
}
}
+
+ public IAdaptable getUserInitiatedAdaptable() {
+ IAdaptable info = new IAdaptable() {
+ public Object getAdapter(Class adapter) {
+ if (String.class.equals(adapter))
+ return "user";
+ return null;
+ }
+ };
+ return info;
+ }
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF 2011-12-06 11:04:27 UTC (rev 36988)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF 2011-12-06 11:07:18 UTC (rev 36989)
@@ -31,7 +31,7 @@
org.eclipse.wst.common.modulecore;bundle-version="1.2.100",
org.eclipse.team.ui;bundle-version="3.6.100",
org.eclipse.jdt.launching;bundle-version="3.6.0",
- org.eclipse.jdt.core;bundle-version="3.7.1",
+ org.eclipse.jdt.core;bundle-version="3.7.0",
org.eclipse.debug.ui;bundle-version="3.7.0",
org.eclipse.ui.navigator;bundle-version="3.5.100",
org.eclipse.ui.console;bundle-version="3.5.100",
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2011-12-06 11:04:27 UTC (rev 36988)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2011-12-06 11:07:18 UTC (rev 36989)
@@ -62,7 +62,7 @@
<extension
point="org.eclipse.wst.server.core.serverTypes">
<serverType
- behaviourClass="org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior"
+ behaviourClass="org.jboss.tools.openshift.express.internal.core.behaviour.ExpressBehaviour"
class="org.jboss.ide.eclipse.as.core.server.internal.JBossServer"
name="%openshift.express.name"
description="%openshift.express.description"
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviour.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviour.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviour.java 2011-12-06 11:07:18 UTC (rev 36989)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.openshift.express.internal.core.behaviour;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.server.core.IModule;
+import org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior;
+
+public class ExpressBehaviour extends DelegatingServerBehavior {
+ private IAdaptable publishAdaptableInfo;
+ public void publish(int kind, List<IModule[]> modules, IProgressMonitor monitor, IAdaptable info) throws CoreException {
+ publishAdaptableInfo = info;
+ try {
+ super.publish(kind, modules, monitor, info);
+ } finally {
+ publishAdaptableInfo = null;
+ }
+ }
+
+ public IAdaptable getPublishAdaptableInfo() {
+ return publishAdaptableInfo;
+ }
+}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviourDelegate.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviourDelegate.java 2011-12-06 11:04:27 UTC (rev 36988)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviourDelegate.java 2011-12-06 11:07:18 UTC (rev 36989)
@@ -10,87 +10,15 @@
*******************************************************************************/
package org.jboss.tools.openshift.express.internal.core.behaviour;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior;
-import org.jboss.ide.eclipse.as.core.server.internal.IJBossBehaviourDelegate;
+import org.jboss.ide.eclipse.as.core.server.internal.AbstractBehaviourDelegate;
-public class ExpressBehaviourDelegate implements IJBossBehaviourDelegate {
- private DelegatingServerBehavior realBehaviour;
+public class ExpressBehaviourDelegate extends AbstractBehaviourDelegate {
public ExpressBehaviourDelegate() {
- // TODO Auto-generated constructor stub
}
@Override
public String getBehaviourTypeId() {
return "openshift";
}
-
- @Override
- public void setActualBehaviour(DelegatingServerBehavior actualBehaviour) {
- realBehaviour = actualBehaviour;
- }
-
- @Override
- public void stop(boolean force) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void publishStart(IProgressMonitor monitor) throws CoreException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void publishFinish(IProgressMonitor monitor) throws CoreException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void onServerStarting() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void onServerStopping() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public IStatus canChangeState(String launchMode) {
- return Status.CANCEL_STATUS;
- }
-
- @Override
- public String getDefaultStopArguments() throws CoreException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void dispose() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void onServerStarted() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void onServerStopped() {
- // TODO Auto-generated method stub
-
- }
-
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java 2011-12-06 11:04:27 UTC (rev 36988)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java 2011-12-06 11:07:18 UTC (rev 36989)
@@ -14,6 +14,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -54,13 +55,29 @@
shareProjects(projects);
projectsLackingGitRepo = null;
}
- return 0;
- }
+ IModule[] modules = behaviour.getServer().getModules();
+ boolean allpublished= true;
+ for (int i = 0; i < modules.length; i++) {
+ if(behaviour.getServer().getModulePublishState(new IModule[]{modules[i]})!=IServer.PUBLISH_STATE_NONE)
+ allpublished=false;
+ }
+ return allpublished ? IServer.PUBLISH_STATE_NONE : IServer.PUBLISH_STATE_INCREMENTAL;
+ }
@Override
public int publishModule(DeployableServerBehavior behaviour, int kind,
int deltaKind, IModule[] module, IProgressMonitor monitor)
throws CoreException {
+
+ // If this action is not user-initiated, bail!
+ IAdaptable a = ((ExpressBehaviour)behaviour).getPublishAdaptableInfo();
+ if( a == null )
+ return -1;
+ String s = (String)a.getAdapter(String.class);
+ if( s == null || !s.equals("user"))
+ return -1;
+
+
int state = behaviour.getServer().getModulePublishState(module);
IProject p = module[module.length-1].getProject();
@@ -75,20 +92,18 @@
return IServer.PUBLISH_STATE_UNKNOWN;
}
- if((kind == IServer.PUBLISH_FULL || state == IServer.PUBLISH_STATE_FULL)) {
- int changed = EGitUtils.countCommitableChanges(p, new NullProgressMonitor() );
- if( changed != 0 && requestCommitAndPushApproval(module, changed)) {
- monitor.beginTask("Publishing " + p.getName(), 200);
- EGitUtils.commit(p, new SubProgressMonitor(monitor, 100));
- EGitUtils.push(EGitUtils.getRepository(p), new SubProgressMonitor(monitor, 100));
- monitor.done();
- return IServer.PUBLISH_STATE_NONE;
- } else if( changed == 0 && requestPushApproval(module)) {
- monitor.beginTask("Publishing " + p.getName(), 100);
- EGitUtils.push(EGitUtils.getRepository(p), new SubProgressMonitor(monitor, 100));
- monitor.done();
- return IServer.PUBLISH_STATE_NONE;
- }
+ int changed = EGitUtils.countCommitableChanges(p, new NullProgressMonitor() );
+ if( changed != 0 && requestCommitAndPushApproval(module, changed)) {
+ monitor.beginTask("Publishing " + p.getName(), 200);
+ EGitUtils.commit(p, new SubProgressMonitor(monitor, 100));
+ EGitUtils.push(EGitUtils.getRepository(p), new SubProgressMonitor(monitor, 100));
+ monitor.done();
+ return IServer.PUBLISH_STATE_NONE;
+ } else if( changed == 0 && requestPushApproval(module)) {
+ monitor.beginTask("Publishing " + p.getName(), 100);
+ EGitUtils.push(EGitUtils.getRepository(p), new SubProgressMonitor(monitor, 100));
+ monitor.done();
+ return IServer.PUBLISH_STATE_NONE;
}
return state;
}
14 years
JBoss Tools SVN: r36988 - 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: 2011-12-06 06:04:27 -0500 (Tue, 06 Dec 2011)
New Revision: 36988
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
Log:
[JBIDE-10171] validating state of project that shall be enabled
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-12-06 10:58:10 UTC (rev 36987)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-12-06 11:04:27 UTC (rev 36988)
@@ -70,8 +70,8 @@
public AdapterWizardPage(ImportProjectWizard wizard, ImportProjectWizardModel model) {
super(
"Import Project",
- "Select the Git clone destination, the branch to clone "
- + "and configure your server adapter ",
+ "Select the project to enable, the Git clone destination, the branch to clone"
+ + " and configure your server adapter ",
"Server Adapter",
wizard);
this.model = new AdapterWizardPageModel(model);
@@ -113,10 +113,10 @@
.to(enableProjectObservable)
.in(dbc);
- Text enabledProjText = new Text(mergeGroup, SWT.BORDER);
- enabledProjText.setEditable(false);
+ Text enabledProjectText = new Text(mergeGroup, SWT.BORDER);
+ enabledProjectText.setEditable(false);
GridDataFactory
- .fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(enabledProjText);
+ .fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(enabledProjectText);
// mergeUriComboViewer.setContentProvider(new ArrayContentProvider());
// mergeUriComboViewer.setLabelProvider(new GitUriLabelProvider());
// mergeUriComboViewer.setInput(model.getMergeUris());
@@ -131,14 +131,16 @@
// .to(WidgetProperties.enabled().observe(mergeUriCombo))
// .in(dbc);
+ IObservableValue enabledProjectNameObservable =
+ BeanProperties.value(AdapterWizardPageModel.PROPERTY_PROJECT_NAME).observe(model);
ValueBindingBuilder
- .bind(WidgetProperties.text().observe(enabledProjText))
- .to(BeanProperties.value(AdapterWizardPageModel.PROPERTY_PROJECT_NAME).observe(model))
+ .bind(WidgetProperties.text().observe(enabledProjectText))
+ .to(enabledProjectNameObservable)
.in(dbc);
ValueBindingBuilder
.bind(enableProjectObservable)
- .to(WidgetProperties.enabled().observe(enabledProjText))
+ .to(WidgetProperties.enabled().observe(enabledProjectText))
.in(dbc);
Button browseProjectsButton = new Button(mergeGroup, SWT.NONE);
@@ -153,6 +155,9 @@
enableProjectObservable.setValue(false);
+ dbc.addValidationStatusProvider(new EnableProjectValidator(enableProjectObservable,
+ enabledProjectNameObservable));
+
return mergeGroup;
}
@@ -393,9 +398,6 @@
serverAdapterCheckbox.getSelection());
this.serverAdapterCheckboxObservable =
WidgetProperties.selection().observe(serverAdapterCheckbox);
-
- SelectedRuntimeValidator selectedRuntimeValidator = new SelectedRuntimeValidator();
- dbc.addValidationStatusProvider(selectedRuntimeValidator);
}
private IServerType getServerTypeToCreate() {
@@ -444,8 +446,21 @@
model.getWizardModel().setProperty(AdapterWizardPageModel.CREATE_SERVER, canCreateServer);
}
- private class SelectedRuntimeValidator extends MultiValidator {
+ /**
+ * A multi validator that validates the state of the project that shall be
+ * (OpenShift) enabled
+ */
+ private class EnableProjectValidator extends MultiValidator {
+ private IObservableValue enableProjectObservable;
+ private IObservableValue enabledProjectNameObservable;
+
+ public EnableProjectValidator(IObservableValue enableProjectObservable,
+ IObservableValue enabledProjectNameObservable) {
+ this.enableProjectObservable = enableProjectObservable;
+ this.enabledProjectNameObservable = enabledProjectNameObservable;
+ }
+
@Override
protected IStatus validate() {
/**
@@ -454,10 +469,18 @@
* is tracking what observables are read to know when he has to
* recalculate it's state.
*/
- if (Boolean.FALSE.equals(serverAdapterCheckboxObservable.getValue())) {
+ if (Boolean.FALSE.equals(enableProjectObservable.getValue())) {
return ValidationStatus.ok();
}
- return ValidationStatus.ok();
+
+ if (enabledProjectNameObservable != null
+ && enabledProjectNameObservable.getValue() != null
+ && (!((String) enabledProjectNameObservable.getValue()).isEmpty())) {
+ return ValidationStatus.ok();
+ } else {
+ return ValidationStatus.error(
+ "You have to select a project that shall be enabled for OpenShift");
+ }
}
}
14 years
JBoss Tools SVN: r36987 - branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-12-06 05:58:10 -0500 (Tue, 06 Dec 2011)
New Revision: 36987
Modified:
branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
Log:
/JBIDE-10318 force-zip ejbs
Modified: branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
===================================================================
--- branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2011-12-06 10:52:00 UTC (rev 36986)
+++ branches/jbosstools-3.3.0.M5/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2011-12-06 10:58:10 UTC (rev 36987)
@@ -313,6 +313,11 @@
return true;
} else if( moduleTypeId.equals(IWTPConstants.FACET_WEB_FRAGMENT)) {
return true;
+ } else if( moduleTypeId.equals(IWTPConstants.FACET_EJB) && moduleTree.length > 1) {
+ String parentModuleTypeId = moduleTree[moduleTree.length - 2].getModuleType().getId();
+ if( !parentModuleTypeId.equals(IWTPConstants.FACET_EAR)) {
+ return true;
+ }
}
return false;
}
14 years
JBoss Tools SVN: r36986 - in trunk/openshift/plugins: org.jboss.tools.openshift.express.ui/META-INF and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-12-06 05:52:00 -0500 (Tue, 06 Dec 2011)
New Revision: 36986
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/SelectEnablableProjectDialog.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/utils/JavaProjectUtils.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/EGitUtils.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java
Log:
[JBIDE-10171] implementing UI to select project that shall be enabled (pushed to) for OpenShift
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/EGitUtils.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/EGitUtils.java 2011-12-06 10:07:34 UTC (rev 36985)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/EGitUtils.java 2011-12-06 10:52:00 UTC (rev 36986)
@@ -107,6 +107,21 @@
}
/**
+ * Returns <code>true</code> if the given project exists and has a .git
+ * folder in it.
+ *
+ * @param project
+ * @return
+ */
+ public static boolean hasDotGitFolder(IProject project) {
+ if (project == null
+ || !project.exists()) {
+ return false;
+ }
+ return new File(project.getLocation().toOSString(), Constants.DOT_GIT).exists();
+ }
+
+ /**
* Shares the given project. A repository is created within the given
* project and the project is connected to the freshly created repository.
*
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF 2011-12-06 10:07:34 UTC (rev 36985)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF 2011-12-06 10:52:00 UTC (rev 36986)
@@ -31,8 +31,8 @@
org.eclipse.wst.common.modulecore;bundle-version="1.2.100",
org.eclipse.team.ui;bundle-version="3.6.100",
org.eclipse.jdt.launching;bundle-version="3.6.0",
+ org.eclipse.jdt.core;bundle-version="3.7.1",
org.eclipse.debug.ui;bundle-version="3.7.0",
- com.jcraft.jsch.source;bundle-version="0.1.44";resolution:=optional,
org.eclipse.ui.navigator;bundle-version="3.5.100",
org.eclipse.ui.console;bundle-version="3.5.100",
org.eclipse.core.expressions;bundle-version="3.4.300"
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-12-06 10:07:34 UTC (rev 36985)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-12-06 10:52:00 UTC (rev 36986)
@@ -20,26 +20,22 @@
import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.core.databinding.validation.MultiValidator;
import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Group;
@@ -54,7 +50,6 @@
import org.jboss.tools.common.ui.ssh.SshPrivateKeysPreferences;
import org.jboss.tools.openshift.express.client.OpenShiftException;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-import org.jboss.tools.openshift.express.internal.ui.wizard.AdapterWizardPageModel.GitUri;
/**
* @author André Dietisheim
@@ -102,39 +97,62 @@
private Group createMergeGroup(Composite parent, DataBindingContext dbc) {
Group mergeGroup = new Group(parent, SWT.BORDER);
- mergeGroup.setText("Git Merge");
+ mergeGroup.setText("Enable Project");
GridDataFactory.fillDefaults()
.align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(mergeGroup);
- GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(2).applyTo(mergeGroup);
+ GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(3).applyTo(mergeGroup);
Button mergeEnabledButton = new Button(mergeGroup, SWT.CHECK);
- mergeEnabledButton.setText("merge with Git URI");
+ mergeEnabledButton.setText("Enable existing project");
GridDataFactory.fillDefaults()
- .align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(mergeEnabledButton);
- IObservableValue mergeEnabledButtonSelection = WidgetProperties.selection().observe(mergeEnabledButton);
- mergeEnabledButtonSelection.setValue(false);
+ .align(SWT.LEFT, SWT.CENTER).applyTo(mergeEnabledButton);
+ IObservableValue enableProjectObservable =
+ BeanProperties.value(AdapterWizardPageModel.PROPERTY_ENABLE_PROJECT).observe(model);
+ ValueBindingBuilder
+ .bind(WidgetProperties.selection().observe(mergeEnabledButton))
+ .to(enableProjectObservable)
+ .in(dbc);
- Combo mergeUriCombo = new Combo(mergeGroup, SWT.NONE);
- ComboViewer mergeUriComboViewer = new ComboViewer(mergeUriCombo);
+ Text enabledProjText = new Text(mergeGroup, SWT.BORDER);
+ enabledProjText.setEditable(false);
GridDataFactory
- .fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(mergeUriCombo);
- mergeUriComboViewer.setContentProvider(new ArrayContentProvider());
- mergeUriComboViewer.setLabelProvider(new GitUriLabelProvider());
- mergeUriComboViewer.setInput(model.getMergeUris());
-// ValueBindingBuilder
-// .bind(WidgetProperties.text().observe(mergeUriCombo))
-// .validatingAfterGet(new MergeUriValidator())
-// .to(BeanProperties.value(AdapterWizardPageModel.PROPERTY_MERGE_URI).observe(model))
-// .in(dbc);
+ .fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(enabledProjText);
+ // mergeUriComboViewer.setContentProvider(new ArrayContentProvider());
+ // mergeUriComboViewer.setLabelProvider(new GitUriLabelProvider());
+ // mergeUriComboViewer.setInput(model.getMergeUris());
+ // ValueBindingBuilder
+ // .bind(WidgetProperties.text().observe(mergeUriCombo))
+ // .validatingAfterGet(new MergeUriValidator())
+ // .to(BeanProperties.value(AdapterWizardPageModel.PROPERTY_MERGE_URI).observe(model))
+ // .in(dbc);
+
+ // ValueBindingBuilder
+ // .bind(mergeEnabledButtonSelection)
+ // .to(WidgetProperties.enabled().observe(mergeUriCombo))
+ // .in(dbc);
+
ValueBindingBuilder
- .bind(WidgetProperties.text().observe(mergeUriCombo))
- .to(BeanProperties.value(AdapterWizardPageModel.PROPERTY_PROJECT_NAME).observe(model))
- .in(dbc);
+ .bind(WidgetProperties.text().observe(enabledProjText))
+ .to(BeanProperties.value(AdapterWizardPageModel.PROPERTY_PROJECT_NAME).observe(model))
+ .in(dbc);
+
ValueBindingBuilder
- .bind(mergeEnabledButtonSelection)
- .to(WidgetProperties.enabled().observe(mergeUriCombo))
+ .bind(enableProjectObservable)
+ .to(WidgetProperties.enabled().observe(enabledProjText))
.in(dbc);
+ Button browseProjectsButton = new Button(mergeGroup, SWT.NONE);
+ browseProjectsButton.setText("Browse");
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(browseProjectsButton);
+ browseProjectsButton.addSelectionListener(onBrowseProjects());
+ ValueBindingBuilder
+ .bind(enableProjectObservable)
+ .to(WidgetProperties.enabled().observe(browseProjectsButton))
+ .in(dbc);
+
+ enableProjectObservable.setValue(false);
+
return mergeGroup;
}
@@ -253,6 +271,23 @@
return cloneGroup;
}
+ private SelectionListener onBrowseProjects() {
+ return new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ SelectEnablableProjectDialog dialog = new SelectEnablableProjectDialog(getShell());
+ if (dialog.open() == Dialog.OK) {
+ Object selectedProject = dialog.getFirstResult();
+ if (selectedProject instanceof IProject) {
+ model.setProjectName(((IProject) selectedProject).getName());
+ }
+ }
+ }
+
+ };
+ }
+
private SelectionListener onDefaultRepoPath() {
return new SelectionAdapter() {
@@ -426,59 +461,59 @@
}
}
- private static class GitUriLabelProvider implements ILabelProvider {
+ // private static class GitUriLabelProvider implements ILabelProvider {
+ //
+ // @Override
+ // public void addListener(ILabelProviderListener listener) {
+ // }
+ //
+ // @Override
+ // public void dispose() {
+ // }
+ //
+ // @Override
+ // public boolean isLabelProperty(Object element, String property) {
+ // return true;
+ // }
+ //
+ // @Override
+ // public void removeListener(ILabelProviderListener listener) {
+ // }
+ //
+ // @Override
+ // public Image getImage(Object element) {
+ // return null;
+ // }
+ //
+ // @Override
+ // public String getText(Object element) {
+ // if (!(element instanceof GitUri)) {
+ // return null;
+ // }
+ // return ((GitUri) element).getLabel();
+ // }
+ // }
- @Override
- public void addListener(ILabelProviderListener listener) {
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public boolean isLabelProperty(Object element, String property) {
- return true;
- }
-
- @Override
- public void removeListener(ILabelProviderListener listener) {
- }
-
- @Override
- public Image getImage(Object element) {
- return null;
- }
-
- @Override
- public String getText(Object element) {
- if (!(element instanceof GitUri)) {
- return null;
- }
- return ((GitUri) element).getLabel();
- }
- }
-
-// private class MergeUriValidator implements IValidator {
-//
-// @Override
-// public IStatus validate(Object value) {
-// String mergeUri = (String) value;
-// if (mergeUri == null
-// || mergeUri.length() == 0) {
-// return ValidationStatus
-// .warning("You have to provide a git uri to merge with");
-// }
-// GitUri gitUri = model.getKnownMergeUri(mergeUri);
-// if (gitUri == null) {
-// return ValidationStatus
-// .warning("You are not merging with an official example. Things may go wrong");
-// }
-// if (!model.isCompatibleToApplicationCartridge(gitUri.getCartridge())) {
-// return ValidationStatus
-// .warning("The example you've chosen is not compatible to your application");
-// }
-// return ValidationStatus.ok();
-// }
-// }
+ // private class MergeUriValidator implements IValidator {
+ //
+ // @Override
+ // public IStatus validate(Object value) {
+ // String mergeUri = (String) value;
+ // if (mergeUri == null
+ // || mergeUri.length() == 0) {
+ // return ValidationStatus
+ // .warning("You have to provide a git uri to merge with");
+ // }
+ // GitUri gitUri = model.getKnownMergeUri(mergeUri);
+ // if (gitUri == null) {
+ // return ValidationStatus
+ // .warning("You are not merging with an official example. Things may go wrong");
+ // }
+ // if (!model.isCompatibleToApplicationCartridge(gitUri.getCartridge())) {
+ // return ValidationStatus
+ // .warning("The example you've chosen is not compatible to your application");
+ // }
+ // return ValidationStatus.ok();
+ // }
+ // }
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java 2011-12-06 10:07:34 UTC (rev 36985)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java 2011-12-06 10:52:00 UTC (rev 36986)
@@ -10,17 +10,11 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jgit.transport.URIish;
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
import org.jboss.tools.openshift.egit.ui.util.EGitUIUtils;
import org.jboss.tools.openshift.express.client.IApplication;
import org.jboss.tools.openshift.express.client.ICartridge;
import org.jboss.tools.openshift.express.client.OpenShiftException;
-import org.jboss.tools.openshift.express.internal.client.Cartridge;
/**
* @author André Dietisheim
@@ -30,6 +24,7 @@
private static final String REMOTE_NAME_DEFAULT = "origin";
+ public static final String PROPERTY_ENABLE_PROJECT = "enableProject";
public static final String PROPERTY_CLONE_URI = "cloneUri";
// public static final String PROPERTY_MERGE_URI = "mergeUri";
public static final String PROPERTY_PROJECT_NAME = "projectName";
@@ -53,6 +48,14 @@
setRemoteName(REMOTE_NAME_DEFAULT);
}
+ public void setEnableProject(boolean enableProject) {
+ firePropertyChange(PROPERTY_ENABLE_PROJECT, wizardModel.isEnableProject(), wizardModel.setEnableProject(enableProject));
+ }
+
+ public boolean isEnableProject() {
+ return wizardModel.isEnableProject();
+ }
+
public void setProjectName(String projectName) {
firePropertyChange(PROPERTY_PROJECT_NAME, wizardModel.getProjectName(), wizardModel.setProjectName(projectName));
}
@@ -69,63 +72,63 @@
// return wizardModel.getMergeUri();
// }
- public GitUri getKnownMergeUri(String uriOrLabel) {
- GitUri gitUri = null;
- if (isGitUri(uriOrLabel)) {
- gitUri = getKnownMergeUriByUri(uriOrLabel);
- } else {
- gitUri = getKnownMergeUriByLabel(uriOrLabel);
- }
- return gitUri;
- }
+// public GitUri getKnownMergeUri(String uriOrLabel) {
+// GitUri gitUri = null;
+// if (isGitUri(uriOrLabel)) {
+// gitUri = getKnownMergeUriByUri(uriOrLabel);
+// } else {
+// gitUri = getKnownMergeUriByLabel(uriOrLabel);
+// }
+// return gitUri;
+// }
- private boolean isGitUri(String gitUriString) {
- try {
- URIish uriish = new URIish(gitUriString);
- return uriish.isRemote();
- } catch (URISyntaxException e) {
- return false;
- }
- }
+// private boolean isGitUri(String gitUriString) {
+// try {
+// URIish uriish = new URIish(gitUriString);
+// return uriish.isRemote();
+// } catch (URISyntaxException e) {
+// return false;
+// }
+// }
- private GitUri getKnownMergeUriByUri(String gitUriString) {
- GitUri matchingGitUri = null;
- for (GitUri gitUri : getMergeUris()) {
- if (gitUri.getGitUri().equals(gitUriString)) {
- matchingGitUri = gitUri;
- break;
- }
- }
- return matchingGitUri;
- }
+// private GitUri getKnownMergeUriByUri(String gitUriString) {
+// GitUri matchingGitUri = null;
+// for (GitUri gitUri : getMergeUris()) {
+// if (gitUri.getGitUri().equals(gitUriString)) {
+// matchingGitUri = gitUri;
+// break;
+// }
+// }
+// return matchingGitUri;
+// }
- private GitUri getKnownMergeUriByLabel(String label) {
- GitUri matchingGitUri = null;
- for (GitUri gitUri : getMergeUris()) {
- if (gitUri.getLabel().equals(label)) {
- matchingGitUri = gitUri;
- break;
- }
- }
- return matchingGitUri;
- }
+// private GitUri getKnownMergeUriByLabel(String label) {
+// GitUri matchingGitUri = null;
+// for (GitUri gitUri : getMergeUris()) {
+// if (gitUri.getLabel().equals(label)) {
+// matchingGitUri = gitUri;
+// break;
+// }
+// }
+// return matchingGitUri;
+// }
- public List<GitUri> getMergeUris() {
- ArrayList<GitUri> mergeUris = new ArrayList<GitUri>();
- mergeUris.add(new GitUri(
- "seambooking-example", "git://github.com/openshift/seambooking-example.git",
- ICartridge.JBOSSAS_7));
- mergeUris.add(new GitUri(
- "tweetstream-example", "git://github.com/openshift/tweetstream-example.git",
- ICartridge.JBOSSAS_7));
- mergeUris.add(new GitUri(
- "sinatra-example", "git://github.com/openshift/sinatra-example.git",
- new Cartridge("rack-1.1")));
- mergeUris.add(new GitUri(
- "sugarcrm-example", "git://github.com/openshift/sugarcrm-example.git",
- new Cartridge("php-5.3")));
- return mergeUris;
- }
+// public List<GitUri> getMergeUris() {
+// ArrayList<GitUri> mergeUris = new ArrayList<GitUri>();
+// mergeUris.add(new GitUri(
+// "seambooking-example", "git://github.com/openshift/seambooking-example.git",
+// ICartridge.JBOSSAS_7));
+// mergeUris.add(new GitUri(
+// "tweetstream-example", "git://github.com/openshift/tweetstream-example.git",
+// ICartridge.JBOSSAS_7));
+// mergeUris.add(new GitUri(
+// "sinatra-example", "git://github.com/openshift/sinatra-example.git",
+// new Cartridge("rack-1.1")));
+// mergeUris.add(new GitUri(
+// "sugarcrm-example", "git://github.com/openshift/sugarcrm-example.git",
+// new Cartridge("php-5.3")));
+// return mergeUris;
+// }
public void loadGitUri() throws OpenShiftException {
setLoading(true);
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java 2011-12-06 10:07:34 UTC (rev 36985)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java 2011-12-06 10:52:00 UTC (rev 36986)
@@ -68,6 +68,7 @@
private HashMap<String, Object> dataModel = new HashMap<String, Object>();
+ public static final String ENABLE_PROJECT = "enableProject";
public static final String USER = "user";
public static final String APPLICATION = "application";
public static final String REMOTE_NAME = "remoteName";
@@ -75,6 +76,10 @@
public static final String PROJECT_NAME = "projectName";
public static final String MERGE_URI = "mergeUri";
+ public ImportProjectWizardModel() {
+ dataModel.put(ENABLE_PROJECT, false);
+ }
+
public Object setProperty(String key, Object value) {
Object oldVal = dataModel.get(key);
dataModel.put(key, value);
@@ -146,6 +151,14 @@
return (String) getProperty(REPOSITORY_PATH);
}
+ public boolean isEnableProject() {
+ return (Boolean) getProperty(ENABLE_PROJECT);
+ }
+
+ public Boolean setEnableProject(boolean enableProject) {
+ return (Boolean) setProperty(ENABLE_PROJECT, enableProject);
+ }
+
public String setProjectName(String projectName) {
return (String) setProperty(PROJECT_NAME, projectName);
}
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/SelectEnablableProjectDialog.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/SelectEnablableProjectDialog.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/SelectEnablableProjectDialog.java 2011-12-06 10:52:00 UTC (rev 36986)
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.ui.wizard;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+import org.eclipse.ui.ide.IDE.SharedImages;
+import org.jboss.tools.openshift.egit.core.EGitUtils;
+import org.jboss.tools.openshift.express.internal.utils.JavaProjectUtils;
+
+/**
+ * @author André Dietisheim
+ */
+public class SelectEnablableProjectDialog extends ElementListSelectionDialog {
+
+ public SelectEnablableProjectDialog(Shell shell) {
+ super(shell, new ProjectLabelProvider());
+ setTitle("Project Selection");
+ setMessage("Please select the project that shall be pushed to OpenShift");
+ setMultipleSelection(false);
+ setAllowDuplicates(false);
+ setElements(getProjects());
+ }
+
+ private Object[] getProjects() {
+ List<IProject> projects = new ArrayList<IProject>();
+ for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
+ if (isValid(project)) {
+ projects.add(project);
+ }
+ }
+ return projects.toArray();
+ }
+
+ private boolean isValid(IProject project) {
+ if (EGitUtils.isShared(project)) {
+ return false;
+ }
+
+ if (EGitUtils.hasDotGitFolder(project)) {
+ return false;
+ }
+
+ if (!JavaProjectUtils.isJavaProject(project)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ private static class ProjectLabelProvider extends LabelProvider {
+
+ @Override
+ public Image getImage(Object element) {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(SharedImages.IMG_OBJ_PROJECT);
+ }
+
+ @Override
+ public String getText(Object element) {
+ if (!(element instanceof IProject)) {
+ return null;
+ }
+
+ return ((IProject) element).getName();
+ }
+
+ }
+
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/SelectEnablableProjectDialog.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/utils/JavaProjectUtils.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/utils/JavaProjectUtils.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/utils/JavaProjectUtils.java 2011-12-06 10:52:00 UTC (rev 36986)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.tools.openshift.express.internal.utils;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.JavaCore;
+
+/**
+ * @author André Dietisheim
+ */
+public class JavaProjectUtils {
+
+ public static boolean isJavaProject(IProject project) {
+ try {
+ if (!project.hasNature(JavaCore.NATURE_ID)) {
+ return false;
+ }
+ } catch (CoreException e) {
+ // project is not opened, does not exist, etc.
+ return false;
+ }
+ return true;
+ }
+
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/utils/JavaProjectUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
14 years
JBoss Tools SVN: r36985 - branches/jbosstools-3.3.0.M5/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/markers.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2011-12-06 05:07:34 -0500 (Tue, 06 Dec 2011)
New Revision: 36985
Modified:
branches/jbosstools-3.3.0.M5/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/markers/MavenDependencyMarkerResolutionGenerator.java
Log:
JBIDE-10356 : fix NPE on maven dependency error markers
Modified: branches/jbosstools-3.3.0.M5/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/markers/MavenDependencyMarkerResolutionGenerator.java
===================================================================
--- branches/jbosstools-3.3.0.M5/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/markers/MavenDependencyMarkerResolutionGenerator.java 2011-12-06 10:04:22 UTC (rev 36984)
+++ branches/jbosstools-3.3.0.M5/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/markers/MavenDependencyMarkerResolutionGenerator.java 2011-12-06 10:07:34 UTC (rev 36985)
@@ -65,10 +65,12 @@
private ResolutionType getResolutionType(IMarker marker) {
ArtifactKey key = getArtifactKey(marker);
- if (key.getVersion().contains(REDHAT_SUFFIX)) {
- return ResolutionType.EAP_REPO;
- } else if (key.getGroupId().startsWith(ORG_JBOSS_PREFIX)) {
- return ResolutionType.JBOSS_REPO;
+ if (key != null) {
+ if (key.getVersion().contains(REDHAT_SUFFIX)) {
+ return ResolutionType.EAP_REPO;
+ } else if (key.getGroupId().startsWith(ORG_JBOSS_PREFIX)) {
+ return ResolutionType.JBOSS_REPO;
+ }
}
return ResolutionType.UNSUPPORTED;
}
14 years
JBoss Tools SVN: r36984 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui: src/org/jboss/tools/openshift/express/internal/ui/console and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2011-12-06 05:04:22 -0500 (Tue, 06 Dec 2011)
New Revision: 36984
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleRemoveAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleTypePropertyTester.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailConsolePageParticipant.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleUtils.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogWorker.java
Log:
OPEN - issue JBIDE-10152: enable console for openshift server rhc-tailfiles
https://issues.jboss.org/browse/JBIDE-10152
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2011-12-06 10:01:12 UTC (rev 36983)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2011-12-06 10:04:22 UTC (rev 36984)
@@ -146,21 +146,20 @@
<!-- Extensions to Server View to provide 'tail' of the remote server.log file -->
- <!-- disabled for now
<extension point="org.eclipse.ui.navigator.navigatorContent">
<actionProvider
class="org.jboss.tools.openshift.express.internal.ui.console.TailServerLogActionProvider"
id="org.jboss.tools.openshift.express.ui.internal.ui.console.tailServerLogActionProvider">
<enablement>
- <and>
- <instanceof
- value="org.eclipse.wst.server.core.IServer">
- </instanceof>
- <test
- forcePluginActivation="true"
- property="org.jboss.tools.openshift.express.isOpenShiftServer">
- </test>
- </and>
+ <and>
+ <instanceof
+ value="org.eclipse.wst.server.core.IServer">
+ </instanceof>
+ <test
+ forcePluginActivation="true"
+ property="org.jboss.tools.openshift.express.isOpenShiftServer">
+ </test>
+ </and>
</enablement>
</actionProvider>
</extension>
@@ -177,6 +176,26 @@
</extension>
<extension
+ point="org.eclipse.ui.console.consolePageParticipants">
+ <consolePageParticipant
+ class="org.jboss.tools.openshift.express.internal.ui.console.TailConsolePageParticipant"
+ id="org.jboss.tools.openshift.express.ui.tailConsolePageParticipant">
+ <enablement>
+ <and>
+ <instanceof
+ value="org.eclipse.ui.console.MessageConsole">
+ </instanceof>
+ <test
+ forcePluginActivation="true"
+ property="org.jboss.tools.openshift.express.isOpenShiftConsole">
+ </test>
+ </and>
+ </enablement>
+ </consolePageParticipant>
+ </extension>
+
+
+ <extension
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
class="org.jboss.tools.openshift.express.internal.ui.console.ServerTypePropertyTester"
@@ -185,7 +204,13 @@
properties="isOpenShiftServer"
type="org.eclipse.wst.server.core.IServer">
</propertyTester>
+ <propertyTester
+ class="org.jboss.tools.openshift.express.internal.ui.console.ConsoleTypePropertyTester"
+ id="org.jboss.tools.openshift.express.ui.consoleTypePropertyTester"
+ namespace="org.jboss.tools.openshift.express"
+ properties="isOpenShiftConsole"
+ type="org.eclipse.ui.console.MessageConsole">
+ </propertyTester>
</extension>
- -->
</plugin>
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleRemoveAction.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleRemoveAction.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleRemoveAction.java 2011-12-06 10:04:22 UTC (rev 36984)
@@ -0,0 +1,15 @@
+package org.jboss.tools.openshift.express.internal.ui.console;
+
+import java.security.Policy;
+
+import org.eclipse.jface.action.Action;
+
+public class ConsoleRemoveAction extends Action {
+
+ ConsoleRemoveAction() {
+ }
+
+ @Override
+ public void run() {
+ }
+}
\ No newline at end of file
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleRemoveAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleTypePropertyTester.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleTypePropertyTester.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleTypePropertyTester.java 2011-12-06 10:04:22 UTC (rev 36984)
@@ -0,0 +1,33 @@
+/**
+ *
+ */
+package org.jboss.tools.openshift.express.internal.ui.console;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.ui.console.MessageConsole;
+import static org.jboss.tools.openshift.express.internal.ui.console.ConsoleUtils.*;
+
+/**
+ * Property tester used to verify that the given instance of
+ * <code>org.eclipse.ui.console.MessageConsole</code> is an OpenShift Message
+ * Console (that is, it should contain a specific attribute set a its creation).
+ *
+ * @author Xavier Coulon
+ *
+ */
+public class ConsoleTypePropertyTester extends PropertyTester {
+
+ /**
+ * Verifies that the given receiver, a <code>MessageConsole</code> contains
+ * an attribute name <code>ConsoleUtils.CONSOLE_TYPE_KEY</code> with a value
+ * set to <code>ConsoleUtils.CONSOLE_TYPE_VALUE</code>. Using the console
+ * attributes avoids the need to create a subtype of
+ * <code>MessageCode</code>.
+ */
+ @Override
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ MessageConsole console = (MessageConsole) receiver;
+ return (CONSOLE_TYPE_VALUE.equals(console.getAttribute(CONSOLE_TYPE_KEY)));
+ }
+
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleTypePropertyTester.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleUtils.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleUtils.java 2011-12-06 10:01:12 UTC (rev 36983)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleUtils.java 2011-12-06 10:04:22 UTC (rev 36984)
@@ -18,14 +18,54 @@
import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleConstants;
+import org.eclipse.ui.console.IConsoleListener;
import org.eclipse.ui.console.IConsoleManager;
import org.eclipse.ui.console.IConsoleView;
import org.eclipse.ui.console.MessageConsole;
import org.jboss.tools.openshift.express.internal.utils.Logger;
+/**
+ * A utility class to manager the message consoles creations and retrivals
+ *
+ * @author Xavier Coulon
+ *
+ */
public class ConsoleUtils {
-
+ /**
+ * Constant key set into the created message console attributes to mark the
+ * given console as an 'openshift' one.
+ */
+ public static final String CONSOLE_TYPE_KEY = "ConsoleType";
+
+ /**
+ * Constant value set into the created message console attributes to mark
+ * the given console as an 'openshift' one.
+ */
+ public static final String CONSOLE_TYPE_VALUE = "OpenShiftTailConsole";
+
+ /**
+ * Registers the given listener as a console listener.
+ *
+ * @param consoleListener
+ */
+ public static void registerConsoleListener(IConsoleListener consoleListener) {
+ ConsolePlugin plugin = ConsolePlugin.getDefault();
+ IConsoleManager consoleManager = plugin.getConsoleManager();
+ consoleManager.addConsoleListener(consoleListener);
+ }
+
+ /**
+ * Retrieve the message console given its name. If no console exists yet, a
+ * new one is created with a specifi attribute to mark it as an 'openshift'
+ * console. This attribute (or marker) is use later on by the
+ * ConsoleTypePropertyTester to add a 'remove' button on the console in the
+ * consoles view.
+ *
+ * @param name
+ * the name of the console to find
+ * @return the message console (found or created)
+ */
public static MessageConsole findMessageConsole(String name) {
ConsolePlugin plugin = ConsolePlugin.getDefault();
IConsoleManager consoleManager = plugin.getConsoleManager();
@@ -37,10 +77,17 @@
}
// no console found, so create a new one
MessageConsole console = new MessageConsole(name, null);
+ console.setAttribute(CONSOLE_TYPE_KEY, CONSOLE_TYPE_VALUE);
consoleManager.addConsoles(new IConsole[] { console });
return console;
}
-
+
+ /**
+ * Displays the given console in the consoles view which becomes visible if
+ * it was not the case before.
+ *
+ * @param console the console to display
+ */
public static void displayConsoleView(IConsole console) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailConsolePageParticipant.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailConsolePageParticipant.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailConsolePageParticipant.java 2011-12-06 10:04:22 UTC (rev 36984)
@@ -0,0 +1,51 @@
+/**
+ *
+ */
+package org.jboss.tools.openshift.express.internal.ui.console;
+
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.IConsoleConstants;
+import org.eclipse.ui.console.IConsolePageParticipant;
+import org.eclipse.ui.console.actions.CloseConsoleAction;
+import org.eclipse.ui.part.IPageBookViewPage;
+
+/**
+ * Console helper that allows contributing actions to the console view when the
+ * Tail console is visible. Added to the console via an extension point from
+ * org.eclipse.ui.console.
+ *
+ * @author Xavier Coulon
+ *
+ */
+public class TailConsolePageParticipant implements IConsolePageParticipant {
+
+ /** The standard Eclipse UI CloseConsoleAction.*/
+ private CloseConsoleAction closeConsoleAction;
+
+ public void init(IPageBookViewPage page, IConsole console) {
+ this.closeConsoleAction = new CloseConsoleAction(console);
+ IActionBars bars = page.getSite().getActionBars();
+ bars.getToolBarManager().appendToGroup(IConsoleConstants.LAUNCH_GROUP, closeConsoleAction);
+ }
+
+ public void dispose() {
+ this.closeConsoleAction = null;
+ }
+
+ public void activated() {
+ }
+
+ public void deactivated() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailConsolePageParticipant.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogAction.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogAction.java 2011-12-06 10:01:12 UTC (rev 36983)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogAction.java 2011-12-06 10:04:22 UTC (rev 36984)
@@ -16,7 +16,9 @@
import org.eclipse.jgit.transport.URIish;
import org.eclipse.jgit.util.FS;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleConstants;
+import org.eclipse.ui.console.IConsoleListener;
import org.eclipse.ui.console.MessageConsole;
import org.eclipse.ui.navigator.CommonViewer;
import org.eclipse.ui.views.IViewDescriptor;
@@ -25,20 +27,29 @@
import org.eclipse.wst.server.ui.IServerModule;
import org.jboss.tools.openshift.express.internal.client.utils.Base64Encoder;
import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
-import org.jboss.tools.openshift.express.internal.ui.console.TailServerLogWorker.MyLogger;
+import org.jboss.tools.openshift.express.internal.ui.console.TailServerLogWorker.JschToEclipseLogger;
import org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages;
import org.jboss.tools.openshift.express.internal.utils.Logger;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
-public class TailServerLogAction extends Action implements ISelectionChangedListener {
+/**
+ * The action associated with the "Show In>Remote Console" menu item.
+ *
+ * @author Xavier Coulon
+ *
+ */
+public class TailServerLogAction extends Action implements ISelectionChangedListener, IConsoleListener {
/** The current selection in the view. */
private ISelection selection = null;
- /** The threads that provide the 'log tail' in the console view. */
- private Map<String, TailServerLogWorker> tailRunners = new HashMap<String, TailServerLogWorker>();
+ /**
+ * The message consoles associated with the 'tail' workers that write the
+ * output.
+ */
+ private Map<String, TailServerLogWorker> consoleWorkers = new HashMap<String, TailServerLogWorker>();
/**
* Constructor
@@ -48,26 +59,26 @@
IViewRegistry reg = PlatformUI.getWorkbench().getViewRegistry();
IViewDescriptor desc = reg.find(IConsoleConstants.ID_CONSOLE_VIEW);
setImageDescriptor(desc.getImageDescriptor());
+ ConsoleUtils.registerConsoleListener(this);
}
/**
+ * Operation called when the user clicks on 'Show In>Remote Console'. If no
+ * Console/Worker existed, a new one is created, otherwise, it is displayed.
* {@inheritDoc}
*/
@Override
public void run() {
final IServer server = getServer();
if (ExpressServerUtils.isOpenShiftRuntime(server)) {
- // start a new thread to which we delegate the remote shell
- // connection + tail command
- final String serverId = server.getId();
MessageConsole console = ConsoleUtils.findMessageConsole(server.getId());
- if (!tailRunners.containsKey(serverId)) {
- TailServerLogWorker tailServerLogRunner;
+ String consoleName = console.getName();
+ if (!this.consoleWorkers.containsKey(consoleName)) {
try {
- final Process process = startTailProcess(server);
- tailServerLogRunner = new TailServerLogWorker(server, console, process);
- tailRunners.put(serverId, tailServerLogRunner);
- Thread thread = new Thread(tailServerLogRunner);
+ final TailServerLogWorker tailServerLogWorker = startTailProcess(server, console);
+ consoleWorkers.put(consoleName, tailServerLogWorker);
+ consoleWorkers.put(console.getName(), tailServerLogWorker);
+ Thread thread = new Thread(tailServerLogWorker);
thread.start();
} catch (Exception e) {
Logger.error("Failed to retrieve remote server logs", e);
@@ -77,27 +88,51 @@
}
}
- private Process startTailProcess(IServer server) throws JSchException, IOException {
+ /**
+ * Starting the tail process on the remote OpenShift Platform. This method
+ * relies on the JGit SSH support (including JSch) to open a connection AND
+ * execute a command in a single invocation. The connection establishement
+ * requires an SSH key, and the passphrase is prompted to the user if
+ * necessary.
+ *
+ * @param server the server adapter on which the action is perforemd
+ * @param console the console into which the tail should be writtent
+ * @return the Worker that encapsulate the established RemoteSession, the tail Process and the output console
+ * @throws JSchException in case of underlying exception
+ * @throws IOException in case of underlying exception
+ */
+ private TailServerLogWorker startTailProcess(final IServer server, final MessageConsole console)
+ throws JSchException, IOException {
final String host = server.getHost();
final String appId = ExpressServerUtils.getExpressApplicationId(server);
final String appName = ExpressServerUtils.getExpressApplicationName(server);
- final String logFilePath = appName + "/logs/server.log";
- final String options = new String(Base64Encoder.encode("-f -n 100".getBytes("UTF-8")), "UTF-8");
+ final String logFilePath = appName + "/logs/*.log";
+ final String options = "-f -n 100";
-
- JSch.setLogger(new MyLogger());
+ JSch.setLogger(new JschToEclipseLogger());
final SshSessionFactory sshSessionFactory = SshSessionFactory.getInstance();
final URIish uri = new URIish().setHost(host).setUser(appId);
- final RemoteSession remoteSession = sshSessionFactory.getSession(uri, CredentialsProvider.getDefault(), FS.DETECTED, 100000);
-
+ RemoteSession remoteSession = sshSessionFactory.getSession(uri, CredentialsProvider.getDefault(), FS.DETECTED,
+ 0);
+
// the rhc-tail-files command template
// ssh_cmd =
// "ssh -t #{app_uuid}(a)#{app}-#{namespace}.#{rhc_domain} 'tail#{opt['opts'] ? ' --opts ' + Base64::encode64(opt['opts']).chomp : ''} #{file_glob}'"
final String command = buildCommand(logFilePath, options);
Process process = remoteSession.exec(command, 0);
- return process;
+ return new TailServerLogWorker(console, process, remoteSession);
+
}
+ /**
+ * Builds the 'ssh tail' command that should be executed on the remote
+ * OpenShift platform.
+ *
+ * @param filePath
+ * @param options
+ * @return
+ * @throws UnsupportedEncodingException
+ */
private String buildCommand(final String filePath, final String options) throws UnsupportedEncodingException {
StringBuilder commandBuilder = new StringBuilder("tail ");
if (options != null && !options.isEmpty()) {
@@ -106,7 +141,7 @@
}
commandBuilder.append(filePath);
final String command = commandBuilder.toString();
- System.out.println("cmd= '" + command + "'");
+ Logger.debug("ssh command to execute: " + command);
return command;
}
@@ -136,10 +171,31 @@
return null;
}
- public IServerModule getServerModule() {
- if (selection instanceof IServerModule)
- return ((IServerModule) selection);
- return null;
+ @Override
+ public void consolesAdded(IConsole[] consoles) {
+ // don't do anything special
}
+ /**
+ * Operation to perform when the console is removed (through the
+ * CloseConsoleAction that was brung by the
+ * <code>TailConsolePageParticipant</code>). In the current case, the
+ * associated worker is stopped and the console/worker are removed from the
+ * map, so that further 'Show In>Remote Console' invocation will trigger a
+ * new worker process.
+ */
+ @Override
+ public void consolesRemoved(IConsole[] consoles) {
+ // if the console is associated with a 'tail' process, stop that process
+ for (IConsole console : consoles) {
+ final String consoleName = console.getName();
+ if (consoleWorkers.containsKey(consoleName)) {
+ final TailServerLogWorker worker = consoleWorkers.get(consoleName);
+ worker.stop();
+ consoleWorkers.remove(consoleName);
+ }
+ }
+
+ }
+
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogWorker.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogWorker.java 2011-12-06 10:01:12 UTC (rev 36983)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/TailServerLogWorker.java 2011-12-06 10:04:22 UTC (rev 36984)
@@ -3,27 +3,43 @@
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
+import org.eclipse.jgit.transport.RemoteSession;
import org.eclipse.ui.console.MessageConsole;
-import org.eclipse.wst.server.core.IServer;
-import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Logger;
+/**
+ * The underlying 'Tail' worker, that uses an established RemoteSession (with
+ * the help of JGit), runs in a dedicated process and displays the outputstream
+ * into a specific console. This worker is a <code>java.lang.Runnable</code> in
+ * order to run in a separate thread
+ *
+ * @author Xavier Coulon
+ *
+ */
public class TailServerLogWorker implements Runnable {
- private final IServer server;
-
+ /** the remote 'tail' process. */
private final Process process;
+ /** the output message console. */
private final MessageConsole console;
- public TailServerLogWorker(final IServer server, final MessageConsole console, final Process process) throws UnsupportedEncodingException,
- JSchException {
- this.server = server;
+ /** the SSH session. */
+ private final RemoteSession remoteSession;
+
+ /**
+ * Constructor.
+ *
+ * @param console
+ * @param process
+ * @param remoteSession
+ */
+ public TailServerLogWorker(final MessageConsole console, final Process process, final RemoteSession remoteSession) {
this.console = console;
this.process = process;
+ this.remoteSession = remoteSession;
}
@Override
@@ -41,14 +57,28 @@
org.jboss.tools.openshift.express.internal.utils.Logger.error(
"Error while receiving the remote server log", e);
} finally {
-
}
}
-
+ /**
+ * Method called when the overall 'tail' process should be stopped: the
+ * underlying ssh remote session must be disconnected and the running
+ * process must be destroyed.
+ */
+ public void stop() {
+ this.remoteSession.disconnect();
+ this.process.destroy();
+ }
- static class MyLogger implements Logger {
+ /**
+ * Bridge between the JSch logger and the Eclipse logger (to ouput results
+ * in the .log files and/or into the 'Error log' view.
+ *
+ * @author Xavier Coulon
+ *
+ */
+ static class JschToEclipseLogger implements Logger {
static java.util.Hashtable<Integer, String> name = new java.util.Hashtable<Integer, String>();
static {
@@ -59,13 +89,26 @@
name.put(new Integer(FATAL), "FATAL: ");
}
+ @Override
public boolean isEnabled(int level) {
return true;
}
+ @Override
public void log(int level, String message) {
- System.err.print(name.get(new Integer(level)));
- System.err.println(message);
+ switch (level) {
+ case DEBUG:
+ case INFO:
+ org.jboss.tools.openshift.express.internal.utils.Logger.debug(message);
+ break;
+ case WARN:
+ org.jboss.tools.openshift.express.internal.utils.Logger.warn(message);
+ break;
+ case ERROR:
+ case FATAL:
+ org.jboss.tools.openshift.express.internal.utils.Logger.error(message);
+ break;
+ }
}
}
14 years
JBoss Tools SVN: r36983 - trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/markers.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2011-12-06 05:01:12 -0500 (Tue, 06 Dec 2011)
New Revision: 36983
Modified:
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/markers/MavenDependencyMarkerResolutionGenerator.java
Log:
JBIDE-10356 : fix NPE on maven dependency error markers
Modified: trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/markers/MavenDependencyMarkerResolutionGenerator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/markers/MavenDependencyMarkerResolutionGenerator.java 2011-12-06 07:38:49 UTC (rev 36982)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/markers/MavenDependencyMarkerResolutionGenerator.java 2011-12-06 10:01:12 UTC (rev 36983)
@@ -65,10 +65,12 @@
private ResolutionType getResolutionType(IMarker marker) {
ArtifactKey key = getArtifactKey(marker);
- if (key.getVersion().contains(REDHAT_SUFFIX)) {
- return ResolutionType.EAP_REPO;
- } else if (key.getGroupId().startsWith(ORG_JBOSS_PREFIX)) {
- return ResolutionType.JBOSS_REPO;
+ if (key != null) {
+ if (key.getVersion().contains(REDHAT_SUFFIX)) {
+ return ResolutionType.EAP_REPO;
+ } else if (key.getGroupId().startsWith(ORG_JBOSS_PREFIX)) {
+ return ResolutionType.JBOSS_REPO;
+ }
}
return ResolutionType.UNSUPPORTED;
}
14 years
JBoss Tools SVN: r36982 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-12-06 02:38:49 -0500 (Tue, 06 Dec 2011)
New Revision: 36982
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
Log:
JBIDE-10318 - user-submitted patch to trunk
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2011-12-06 06:45:28 UTC (rev 36981)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2011-12-06 07:38:49 UTC (rev 36982)
@@ -313,6 +313,11 @@
return true;
} else if( moduleTypeId.equals(IWTPConstants.FACET_WEB_FRAGMENT)) {
return true;
+ } else if( moduleTypeId.equals(IWTPConstants.FACET_EJB) && moduleTree.length > 1) {
+ String parentModuleTypeId = moduleTree[moduleTree.length - 2].getModuleType().getId();
+ if( !parentModuleTypeId.equals(IWTPConstants.FACET_EAR)) {
+ return true;
+ }
}
return false;
}
14 years
JBoss Tools SVN: r36981 - branches/jbosstools-3.3.0.M5/central/features/org.jboss.tools.central.feature.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2011-12-06 01:45:28 -0500 (Tue, 06 Dec 2011)
New Revision: 36981
Modified:
branches/jbosstools-3.3.0.M5/central/features/org.jboss.tools.central.feature/feature.xml
Log:
JBIDE-10308 feature.xml providername restored
Modified: branches/jbosstools-3.3.0.M5/central/features/org.jboss.tools.central.feature/feature.xml
===================================================================
--- branches/jbosstools-3.3.0.M5/central/features/org.jboss.tools.central.feature/feature.xml 2011-12-06 06:40:57 UTC (rev 36980)
+++ branches/jbosstools-3.3.0.M5/central/features/org.jboss.tools.central.feature/feature.xml 2011-12-06 06:45:28 UTC (rev 36981)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<feature id="org.jboss.tools.central.feature" label="%featureName" version="1.0.0.qualifier" provider-name="%featureName" plugin="org.jboss.tools.central">
+<feature id="org.jboss.tools.central.feature" label="%featureName" version="1.0.0.qualifier" provider-name="%providerName" plugin="org.jboss.tools.central">
<description>
%description
</description>
14 years