</product>
</extension>
<extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="menu:org.eclipse.ui.main.menu">
+ <menu
+ id="fileMenu"
+ label="File">
+ <command
+ commandId="org.argeo.slc.client.rcp.commands.Exit"
+ label="Exit"
+ style="push"
+ tooltip="Exits the application">
+ </command>
+ </menu>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ defaultHandler="org.argeo.slc.client.rcp.commands.ExitHandler"
+ id="org.argeo.slc.client.rcp.commands.Exit"
+ name="Exit">
+ </command>
+ </extension>
+ <!-- <extension
id="product"
point="org.eclipse.core.runtime.products">
<product
value="SLC">
</property>
</product>
- </extension>
+ </extension> -->
</plugin>
package org.argeo.slc.client.rcp;
import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;
// them
// in the fill methods. This ensures that the actions aren't recreated
// when fillActionBars is called with FILL_PROXY.
- private IWorkbenchAction exitAction;
public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
super(configurer);
// file.
// Registering also provides automatic disposal of the actions when
// the window is closed.
-
- exitAction = ActionFactory.QUIT.create(window);
- register(exitAction);
}
protected void fillMenuBar(IMenuManager menuBar) {
- MenuManager fileMenu = new MenuManager("&File",
- IWorkbenchActionConstants.M_FILE);
- menuBar.add(fileMenu);
- fileMenu.add(exitAction);
}
}
import org.argeo.slc.client.ui.views.ExecutionModulesView;
import org.argeo.slc.client.ui.views.ResultListView;
-import org.argeo.slc.client.ui.views.SlcExecutionListView;
+import org.argeo.slc.client.ui.views.ProcessListView;
import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
topRight.addView(ResultListView.ID);
IFolderLayout bottomRight = layout.createFolder("bottomRight",
IPageLayout.BOTTOM, 0.5f, "topRight");
- bottomRight.addView(SlcExecutionListView.ID);
+ bottomRight.addView(ProcessListView.ID);
// layout.addStandaloneView(SlcExecutionListView.ID, false,
// IPageLayout.BOTTOM, 0.5f, editorArea);
}
--- /dev/null
+package org.argeo.slc.client.rcp.commands;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+public class ExitHandler extends AbstractHandler {
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ HandlerUtil.getActiveWorkbenchWindow(event).close();
+ return null;
+ }
+
+}
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.argeo.slc.client.ui,
- org.argeo.slc.client.ui.actions,
org.argeo.slc.client.ui.services,
org.argeo.slc.client.ui.views
Import-Package: org.apache.commons.logging;version="1.1.1",
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <bean id="org.argeo.slc.client.ui.RefreshResultList" class="org.argeo.slc.client.ui.commands.RefreshHandler"
+ scope="prototype">
+ </bean>
+
+
+</beans>
scope="prototype">
<property name="testResultCollectionDao" ref="testResultCollectionDao" />
</bean>
-
- <bean id="org.argeo.slc.client.ui.SlcExecutionListView" class="org.argeo.slc.client.ui.views.SlcExecutionListView"
+
+ <bean id="org.argeo.slc.client.ui.ProcessListView" class="org.argeo.slc.client.ui.views.ProcessListView"
scope="prototype">
<property name="slcExecutionDao" ref="slcExecutionDao" />
</bean>
<?eclipse version="3.4"?>
<plugin>
+
<extension
point="org.eclipse.ui.views">
<view
restorable="true">
</view>
<view
- id="org.argeo.slc.client.ui.SlcExecutionListView"
+ id="org.argeo.slc.client.ui.ProcessListView"
class="org.argeo.eclipse.spring.SpringExtensionFactory"
- name="Slc Executions"
+ name="Process List"
restorable="true">
</view>
</extension>
- <extension
- point="org.eclipse.ui.actionSets">
- <actionSet
- label="SLC Action Set"
- visible="true"
- id="org.argeo.slc.client.ui.actionSet">
- <menu
- label="SLC"
- id="slcMenu">
- <separator
- name="slcGroup">
- </separator>
- </menu>
- <action
- label="Refresh"
- icon="icons/refresh.png"
- class="org.argeo.slc.client.ui.actions.RefreshAction"
- tooltip="Refresh"
- menubarPath="slcMenu/slcGroup"
- toolbarPath="slcGroup"
- id="org.argeo.slc.client.ui.actions.RefreshAction">
- </action>
- </actionSet>
- </extension>
<extension
point="org.eclipse.ui.commands">
+ <!--defaultHandler="org.argeo.slc.client.ui.commands.RefreshHandler" -->
<command
- defaultHandler="org.argeo.slc.client.ui.commands.RefreshHandler"
+ defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
id="org.argeo.slc.client.ui.RefreshResultList"
name="RefreshResultList ">
</command>
</extension>
+ <extension
+ point="org.eclipse.ui.bindings">
+ <key
+ commandId="org.argeo.slc.client.ui.RefreshResultList"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="CTRL+R">
+ </key>
+ </extension>
+
+ <extension
+ id="menu:org.eclipse.ui.main.menu"
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="menu:org.eclipse.ui.main.menu?after=fileMenu">
+ <menu
+ id="slcMenu"
+ label="SLC">
+ <command
+ commandId="org.argeo.slc.client.ui.RefreshResultList"
+ label="Refresh"
+ style="push"
+ tooltip="Refresh the result list">
+ </command>
+ </menu>
+ </menuContribution>
+ <menuContribution
+ locationURI="toolbar:org.eclipse.ui.main.toolbar">
+ <toolbar
+ id="org.argeo.slc.client.ui.ResultViewToolbar">
+ <command
+ commandId="org.argeo.slc.client.ui.RefreshResultList"
+ icon="icons/refresh.png"
+ label="Refresh"
+ style="toggle"
+ tooltip="Refresh the result list">
+ </command>
+ <separator
+ name="resultListViewGroup">
+ </separator>
+ </toolbar>
+ </menuContribution>
+ </extension>
</plugin>
+++ /dev/null
-package org.argeo.slc.client.ui.actions;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.client.ui.views.ResultListView;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-/**
- * Our sample action implements workbench action delegate. The action proxy will
- * be created by the workbench and shown in the UI. When the user tries to use
- * the action, this delegate will be created and execution will be delegated to
- * it.
- *
- * @see IWorkbenchWindowActionDelegate
- */
-public class RefreshAction implements IWorkbenchWindowActionDelegate {
- private final static Log log = LogFactory.getLog(RefreshAction.class);
- private IWorkbenchWindow window;
-
- /**
- * The constructor.
- */
- public RefreshAction() {
- }
-
- /**
- * The action has been activated. The argument of the method represents the
- * 'real' action sitting in the workbench UI.
- *
- * @see IWorkbenchWindowActionDelegate#run
- */
- public void run(IAction action) {
- // ExecutionModulesView view = (ExecutionModulesView) window
- // .getWorkbench().getActiveWorkbenchWindow().getActivePage()
- // .findView(ExecutionModulesView.ID);
- // view.getViewer().refresh();
- // MessageDialog.openInformation(window.getShell(), "Ui", "Refreshed");
- log.info("command");
- ResultListView view = (ResultListView) window.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().findView(
- ResultListView.ID);
- view.retrieveResults();
- }
-
- /**
- * Selection in the workbench has been changed. We can change the state of
- * the 'real' action here if we want, but this can only happen after the
- * delegate has been created.
- *
- * @see IWorkbenchWindowActionDelegate#selectionChanged
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- /**
- * We can use this method to dispose of any system resources we previously
- * allocated.
- *
- * @see IWorkbenchWindowActionDelegate#dispose
- */
- public void dispose() {
- }
-
- /**
- * We will cache window object in order to be able to provide parent shell
- * for the message dialog.
- *
- * @see IWorkbenchWindowActionDelegate#init
- */
- public void init(IWorkbenchWindow window) {
- this.window = window;
- }
-}
\ No newline at end of file
package org.argeo.slc.client.ui.commands;
import org.argeo.slc.client.ui.views.ResultListView;
-import org.argeo.slc.client.ui.views.SlcExecutionListView;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
.getActiveWorkbenchWindow(event).getActivePage().findView(
ResultListView.ID);
view.retrieveResults();
- SlcExecutionListView selView = (SlcExecutionListView) HandlerUtil
- .getActiveWorkbenchWindow(event).getActivePage().findView(
- SlcExecutionListView.ID);
- selView.retrieveResults();
+ // ProcessListView pView = (ProcessListView) HandlerUtil
+ // .getActiveWorkbenchWindow(event).getActivePage().findView(
+ // ProcessListView.ID);
+ // pView.retrieveResults();
return null;
}
package org.argeo.slc.client.ui.services;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.argeo.slc.SlcException;
import org.argeo.slc.client.ui.ClientUiPlugin;
import org.argeo.slc.core.attachment.Attachment;
/** In memory access to a test manager service */
public class TestManagerServiceAdapter implements TreeTestResultListener {
- private static final Log log = LogFactory
- .getLog(TestManagerServiceAdapter.class);
+ // private static final Log log = LogFactory
+ // .getLog(TestManagerServiceAdapter.class);
private Boolean onlyOnClose = false;
--- /dev/null
+package org.argeo.slc.client.ui.views;
+
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.argeo.slc.core.test.tree.ResultAttributes;
+import org.argeo.slc.dao.process.SlcExecutionDao;
+import org.argeo.slc.process.SlcExecution;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.part.ViewPart;
+
+public class ProcessListView extends ViewPart {
+ private final static Log log = LogFactory
+ .getLog(ProcessListView.class);
+
+ public static final String ID = "org.argeo.slc.client.ui.ProcessListView";
+
+ private TableViewer viewer;
+
+ private SlcExecutionDao slcExecutionDao;
+
+ public void createPartControl(Composite parent) {
+ Table table = createTable(parent);
+ viewer = new TableViewer(table);
+ viewer.setLabelProvider(new ViewLabelProvider());
+ viewer.setContentProvider(new ViewContentProvider());
+
+ viewer.setInput(getViewSite());
+ }
+
+ protected Table createTable(Composite parent) {
+ int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
+ | SWT.FULL_SELECTION | SWT.HIDE_SELECTION;
+
+ Table table = new Table(parent, style);
+
+ GridData gridData = new GridData(GridData.FILL_BOTH);
+ gridData.grabExcessVerticalSpace = true;
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.horizontalSpan = 3;
+ table.setLayoutData(gridData);
+
+ table.setLinesVisible(true);
+ table.setHeaderVisible(true);
+
+ TableColumn column = new TableColumn(table, SWT.LEFT, 0);
+ column.setText("Date");
+ column.setWidth(200);
+
+ column = new TableColumn(table, SWT.LEFT, 1);
+ column.setText("Host");
+ column.setWidth(100);
+
+ column = new TableColumn(table, SWT.LEFT, 2);
+ column.setText("Id");
+ column.setWidth(300);
+
+ column = new TableColumn(table, SWT.LEFT, 3);
+ column.setText("Status");
+ column.setWidth(100);
+
+ return table;
+ }
+
+ protected static class ViewContentProvider implements
+ IStructuredContentProvider {
+
+ public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
+ }
+
+ public void dispose() {
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object[] getElements(Object obj) {
+ if (obj instanceof List) {
+ return ((List<ResultAttributes>) obj).toArray();
+ } else {
+ return new Object[0];
+ }
+ }
+ }
+
+ protected class ViewLabelProvider extends LabelProvider implements
+ ITableLabelProvider {
+ public String getColumnText(Object obj, int index) {
+ SlcExecution ra = (SlcExecution) obj;
+ switch (index) {
+
+ case 0:
+ return getText(ra.getStartDate());
+ case 1:
+ return ra.getHost();
+ case 2:
+ return ra.getUuid();
+ case 3:
+ return ra.currentStep().getType();
+ }
+ return getText(obj);
+ }
+
+ public Image getColumnImage(Object obj, int index) {
+ return null;
+ }
+
+ }
+
+ public void setFocus() {
+ viewer.getControl().setFocus();
+ }
+
+ public void retrieveResults() {
+ try {
+ List<SlcExecution> lst = slcExecutionDao.listSlcExecutions();
+
+ if (log.isTraceEnabled())
+ log.trace("Result attributes count: " + lst.size());
+ viewer.setInput(lst);
+ // viewer.refresh();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ public void setSlcExecutionDao(SlcExecutionDao slcExecutionDao) {
+ this.slcExecutionDao = slcExecutionDao;
+ }
+
+}
+++ /dev/null
-package org.argeo.slc.client.ui.views;
-
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.core.test.tree.ResultAttributes;
-import org.argeo.slc.dao.process.SlcExecutionDao;
-import org.argeo.slc.process.SlcExecution;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.ui.part.ViewPart;
-
-public class SlcExecutionListView extends ViewPart {
- private final static Log log = LogFactory
- .getLog(SlcExecutionListView.class);
-
- public static final String ID = "org.argeo.slc.client.ui.SlcExecutionListView";
-
- private TableViewer viewer;
-
- private SlcExecutionDao slcExecutionDao;
-
- public void createPartControl(Composite parent) {
- Table table = createTable(parent);
- viewer = new TableViewer(table);
- viewer.setLabelProvider(new ViewLabelProvider());
- viewer.setContentProvider(new ViewContentProvider());
-
- viewer.setInput(getViewSite());
- }
-
- protected Table createTable(Composite parent) {
- int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
- | SWT.FULL_SELECTION | SWT.HIDE_SELECTION;
-
- Table table = new Table(parent, style);
-
- GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.grabExcessVerticalSpace = true;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 3;
- table.setLayoutData(gridData);
-
- table.setLinesVisible(true);
- table.setHeaderVisible(true);
-
- TableColumn column = new TableColumn(table, SWT.LEFT, 0);
- column.setText("Date");
- column.setWidth(200);
-
- column = new TableColumn(table, SWT.LEFT, 1);
- column.setText("Host");
- column.setWidth(100);
-
- column = new TableColumn(table, SWT.LEFT, 2);
- column.setText("Id");
- column.setWidth(300);
-
- column = new TableColumn(table, SWT.LEFT, 3);
- column.setText("Status");
- column.setWidth(100);
-
- return table;
- }
-
- protected static class ViewContentProvider implements
- IStructuredContentProvider {
-
- public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
- }
-
- public void dispose() {
- }
-
- @SuppressWarnings("unchecked")
- public Object[] getElements(Object obj) {
- if (obj instanceof List) {
- return ((List<ResultAttributes>) obj).toArray();
- } else {
- return new Object[0];
- }
- }
- }
-
- protected class ViewLabelProvider extends LabelProvider implements
- ITableLabelProvider {
- public String getColumnText(Object obj, int index) {
- SlcExecution ra = (SlcExecution) obj;
- switch (index) {
-
- case 0:
- return getText(ra.getStartDate());
- case 1:
- return ra.getHost();
- case 2:
- return ra.getUuid();
- case 3:
- return ra.currentStep().getType();
- }
- return getText(obj);
- }
-
- public Image getColumnImage(Object obj, int index) {
- return null;
- }
-
- }
-
- public void setFocus() {
- viewer.getControl().setFocus();
- }
-
- public void retrieveResults() {
- try {
- List<SlcExecution> lst = slcExecutionDao.listSlcExecutions();
-
- if (log.isTraceEnabled())
- log.trace("Result attributes count: " + lst.size());
- viewer.setInput(lst);
- // viewer.refresh();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- public void setSlcExecutionDao(SlcExecutionDao slcExecutionDao) {
- this.slcExecutionDao = slcExecutionDao;
- }
-
-}