X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=eclipse%2Fplugins%2Forg.argeo.slc.client.ui%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fclient%2Fui%2Fviews%2FJcrExecutionModulesView.java;h=1f87c98fdeb32a1c614bde722c0ab877595c989e;hb=8908d07cc1fd6ac0a274c460bbd40652816ca054;hp=db5490391ad0bfaa3dad504078359286bdb21f0b;hpb=a04bdc0fac50a960370e068bf854a83e503b0ab7;p=gpl%2Fargeo-slc.git diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/JcrExecutionModulesView.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/JcrExecutionModulesView.java index db5490391..1f87c98fd 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/JcrExecutionModulesView.java +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/JcrExecutionModulesView.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.argeo.slc.client.ui.views; import java.util.ArrayList; @@ -25,6 +40,7 @@ import org.argeo.eclipse.ui.jcr.AsyncUiEventListener; import org.argeo.eclipse.ui.jcr.DefaultNodeLabelProvider; import org.argeo.eclipse.ui.jcr.NodeElementComparer; import org.argeo.eclipse.ui.jcr.SimpleNodeContentProvider; +import org.argeo.eclipse.ui.specific.EclipseUiSpecificUtils; import org.argeo.slc.BasicNameVersion; import org.argeo.slc.NameVersion; import org.argeo.slc.SlcException; @@ -35,6 +51,10 @@ import org.argeo.slc.execution.ExecutionModulesManager; import org.argeo.slc.jcr.SlcJcrConstants; import org.argeo.slc.jcr.SlcNames; import org.argeo.slc.jcr.SlcTypes; +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.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.IStructuredSelection; @@ -69,12 +89,9 @@ public class JcrExecutionModulesView extends ViewPart implements SlcTypes, public void createPartControl(Composite parent) { viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - - // FIXME : does not work in RAP, find a way to have it for RCP only - // ColumnViewerToolTipSupport.enableFor(viewer); + EclipseUiSpecificUtils.enableToolTipSupport(viewer); ViewContentProvider contentProvider = new ViewContentProvider(session); - viewer.setContentProvider(contentProvider); viewer.setComparer(new NodeElementComparer()); final ViewLabelProvider viewLabelProvider = new ViewLabelProvider(); @@ -247,8 +264,9 @@ public class JcrExecutionModulesView extends ViewPart implements SlcTypes, if (session.itemExists(path)) { Node parentNode = session.getNode(path);// .getParent(); - if (log.isDebugEnabled()) - log.debug("Refresh " + parentNode); + if (log.isTraceEnabled()) + log.trace("Refresh " + parentNode + " after event " + + event); viewer.refresh(parentNode); } } catch (RepositoryException e) { @@ -273,7 +291,10 @@ public class JcrExecutionModulesView extends ViewPart implements SlcTypes, @Override protected String getText(Node node) throws RepositoryException { - if (node.getName().equals(SLC_EXECUTION_SPECS)) + if (node.isNodeType(NodeType.MIX_TITLE) + && node.hasProperty(Property.JCR_TITLE)) + return node.getProperty(Property.JCR_TITLE).getString(); + else if (node.getName().equals(SLC_EXECUTION_SPECS)) return "Execution Specifications"; else if (node.getPath().equals( SlcJcrConstants.VM_AGENT_FACTORY_PATH)) @@ -336,15 +357,43 @@ public class JcrExecutionModulesView extends ViewPart implements SlcTypes, String name = node.getProperty(SLC_NAME).getString(); String version = node.getProperty(SLC_VERSION) .getString(); - NameVersion nameVersion = new BasicNameVersion(name, - version); + final NameVersion nameVersion = new BasicNameVersion( + name, version); Boolean started = node.getProperty(SLC_STARTED) .getBoolean(); + + Job job; if (started) { - modulesManager.stop(nameVersion); + job = new Job("Stop " + nameVersion) { + protected IStatus run(IProgressMonitor monitor) { + monitor.beginTask("Stop " + nameVersion, 1); + modulesManager.stop(nameVersion); + monitor.worked(1); + return Status.OK_STATUS; + } + + protected void canceling() { + getThread().interrupt(); + super.canceling(); + } + }; } else { - modulesManager.start(nameVersion); + job = new Job("Start " + nameVersion) { + protected IStatus run(IProgressMonitor monitor) { + monitor.beginTask("Start " + nameVersion, 1); + modulesManager.start(nameVersion); + monitor.worked(1); + return Status.OK_STATUS; + } + + protected void canceling() { + getThread().interrupt(); + super.canceling(); + } + }; } + job.setUser(true); + job.schedule(); } else { String path = node.getPath(); // TODO factorize with editor