Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » job scheduler with quartz
job scheduler with quartz [message #714056] Tue, 09 August 2011 17:40 Go to next message
Li Hao is currently offline Li Hao
Messages: 28
Registered: August 2011
Junior Member
Is there a way to use quartz scheduler with scout? I am testing scout with a existing web application which has some quartz schedule jobs. I would like to reuse those existing quartz jobs.
Re: job scheduler with quartz [message #719182 is a reply to message #714056] Fri, 26 August 2011 09:08 Go to previous messageGo to next message
Andreas Hoegger is currently offline Andreas Hoegger
Messages: 174
Registered: February 2010
Senior Member
Scout provides a Scheduler which provides the execution of periodically
execution of jobs. To get there add the following lines to your
ServerApplication.start method:

Scheduler scheduler = new
Scheduler(Activator.getDefault().getBackendSubject(),
ServerSession.class, new Ticker(Calendar.SECOND));
scheduler.addJob(new AbstractSchedulerJob("anyGroupId", "aJobId") {
@Override
protected boolean execAcceptTick(TickSignal signal, int second,
int minute, int hour, int day, int week, int month, int year, int
dayOfWeek, int dayOfMonthReverse, int dayOfYear, int secondOfDay) {
return second % 10 == 0;
}

@Override
public void run(IScheduler scheduler, TickSignal signal) throws
ProcessingException {
System.out.println("executed job... " + signal.getMinute() +
"-" + signal.getSecond());
}
});
scheduler.start();
Activator.getDefault().setScheduler(scheduler);

To add SchedulerJobs from anywhere use
Activator.getDefault().getScheduler().addJob(...).

Does the scheduler fit your needs?

-Andreas

On 09.08.2011 19:40, irheat wrote:
> Is there a way to use quartz scheduler with scout? I am testing scout
> with a existing web application which has some quartz schedule jobs. I
> would like to reuse those existing quartz jobs.
Re: job scheduler with quartz [message #719258 is a reply to message #719182] Fri, 26 August 2011 14:20 Go to previous messageGo to next message
Li Hao is currently offline Li Hao
Messages: 28
Registered: August 2011
Junior Member
Thanks Andreas, I have read the doc in scout wiki on the scheduler. My problem is that the app I just take over has quite a few schedule job in quartz, those jobs has already in production and I hope there is some way that I can reuse them without major rewrite of code. Anyway I have started to convert some of the simple one using the scout scheduler now.

By the way, how do I change outline view in swt client? I try the OutlineViewButton approach suggested in another post, it work on swing client, but not in swt client.
Re: job scheduler with quartz [message #719302 is a reply to message #719258] Fri, 26 August 2011 16:15 Go to previous messageGo to next message
Andreas Hoegger is currently offline Andreas Hoegger
Messages: 174
Registered: February 2010
Senior Member
The easiest way to get multiple outline support is to somewhere create
implementations of AbstractOutlineButton. Alternatively you can take a
look in AbstractOutlineButton what has to be done to activate an Outline.
The attached 'TestOutlineTreeForm' contains a snap box with several
outline buttons. In case of using this class aware to the change the
'execOpened' method in your Desktop to open the 'TestOutlineTreeForm'
instead of the DefaultOutlineTreeForm.

Regarding the Quarz library:
I'll try to run a Quarz scheduler in an Eclipse RCP environment. If that
works there is no reason to change any of your Quarz jobs.

- Andreas

On 26.08.2011 16:20, irheat wrote:
> Thanks Andreas, I have read the doc in scout wiki on the scheduler. My
> problem is that the app I just take over has quite a few schedule job in
> quartz, those jobs has already in production and I hope there is some
> way that I can reuse them without major rewrite of code. Anyway I have
> started to convert some of the simple one using the scout scheduler now.
>
> By the way, how do I change outline view in swt client? I try the
> OutlineViewButton approach suggested in another post, it work on swing
> client, but not in swt client.


package org.eclipse.scout.rt.test.client.ui.forms;

import org.eclipse.scout.commons.annotations.Order;
import org.eclipse.scout.commons.exception.ProcessingException;
import org.eclipse.scout.commons.logger.IScoutLogger;
import org.eclipse.scout.commons.logger.ScoutLogManager;
import org.eclipse.scout.rt.client.ClientSyncJob;
import org.eclipse.scout.rt.client.ui.basic.tree.ITree;
import org.eclipse.scout.rt.client.ui.desktop.DesktopEvent;
import org.eclipse.scout.rt.client.ui.desktop.DesktopListener;
import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
import org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutlineButton;
import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
import org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineTreeForm;
import org.eclipse.scout.rt.client.ui.form.AbstractForm;
import org.eclipse.scout.rt.client.ui.form.AbstractFormHandler;
import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
import org.eclipse.scout.rt.client.ui.form.fields.snapbox.AbstractSnapBox;
import org.eclipse.scout.rt.client.ui.form.fields.treefield.AbstractTreeField;
import org.eclipse.scout.rt.test.client.outline.MainOutline;
import org.eclipse.scout.rt.test.client.outline.StandardOutline;
import org.eclipse.scout.rt.test.client.ui.forms.TestOutlineTreeForm.MainBox.OutlineTreeField;

public class TestOutlineTreeForm extends AbstractForm implements IOutlineTreeForm {
private static final IScoutLogger LOG = ScoutLogManager.getLogger(TestOutlineTreeForm.class);
private DesktopListener m_desktopListener;

public TestOutlineTreeForm() throws ProcessingException {
super();
}

@Override
protected boolean getConfiguredAskIfNeedSave() {
return false;
}

@Override
protected boolean getConfiguredCacheBounds() {
return true;
}

@Override
protected int getConfiguredDisplayHint() {
return DISPLAY_HINT_VIEW;
}

@Override
protected String getConfiguredDisplayViewId() {
return VIEW_ID_OUTLINE;
}

@Override
protected void execInitForm() throws ProcessingException {
m_desktopListener = new DesktopListener() {
@Override
public void desktopChanged(DesktopEvent e) {
switch (e.getType()) {
case DesktopEvent.TYPE_OUTLINE_CHANGED: {
installTree(e.getOutline());
break;
}
}
}

};
IDesktop desktop = ClientSyncJob.getCurrentSession().getDesktop();
desktop.addDesktopListener(m_desktopListener);
installTree(desktop.getOutline());

}

@Override
protected void execDisposeForm() throws ProcessingException {
super.execDisposeForm();
ClientSyncJob.getCurrentSession().getDesktop().removeDesktopListener(m_desktopListener);
m_desktopListener = null;
}

private void installTree(ITree tree) {
getOutlineTreeField().setTree(tree, true);
// IDesktop desktop=ClientJob.getCurrentSession().getDesktop();
if (tree != null) {
setTitle(tree.getTitle());
setIconId(tree.getIconId());
}
}

public MainBox getMainBox() {
return (MainBox) getRootGroupBox();
}

public OutlineTreeField getOutlineTreeField() {
return getFieldByClass(OutlineTreeField.class);
}

public void startView() throws ProcessingException {
startInternal(new ViewHandler());
}

@Order(10.0f)
public class MainBox extends AbstractGroupBox {

@Override
protected boolean getConfiguredBorderVisible() {
return false;
}

@Override
protected String getConfiguredBorderDecoration() {
return BORDER_DECORATION_EMPTY;
}

@Override
protected int getConfiguredGridColumnCount() {
return 1;
}

@Order(10.0f)
public class OutlineTreeField extends AbstractTreeField {
@Override
protected boolean getConfiguredLabelVisible() {
return false;
}

@Override
protected int getConfiguredGridW() {
return 1;
}

@Override
protected int getConfiguredGridH() {
return 20;
}
}

@Order(20.0)
public class OutlineSelectorField extends AbstractSnapBox {

@Override
public int getConfiguredGridH() {
return 1;
}

@Override
protected int getConfiguredGridW() {
return 1;
}

@Override
protected boolean getConfiguredGridUseUiHeight() {
return true;
}

@Order(10.0)
public class MainOutlineButton extends AbstractOutlineButton {
@Override
protected Class<? extends IOutline> getConfiguredOutline() {
return MainOutline.class;
}
}

@Order(20.0)
public class StandardOutlineButton extends AbstractOutlineButton {
@Override
protected Class<? extends IOutline> getConfiguredOutline() {
return StandardOutline.class;
}
}
}

}

@Order(10.0f)
public class ViewHandler extends AbstractFormHandler {
}
}
Re: job scheduler with quartz [message #719314 is a reply to message #719258] Fri, 26 August 2011 16:57 Go to previous messageGo to next message
Andreas Hoegger is currently offline Andreas Hoegger
Messages: 174
Registered: February 2010
Senior Member
And the quarz example.
To get quarz running you have to add the quarz libraries to server
bundle classpath (Manifest.MF - Runtime - Classpath) and start a
Scheduler in the 'ServerApplication.start' method and stop it again in
the 'ServerApplication.stop' method. The quarz.properties file has to be
on the classpath as well - easiest way is to put it in the src folder.
You can find an example in the attached zip file where the quarz libs
are removed due to license issues.

-Andreas

On 26.08.2011 16:20, irheat wrote:
> Thanks Andreas, I have read the doc in scout wiki on the scheduler. My
> problem is that the app I just take over has quite a few schedule job in
> quartz, those jobs has already in production and I hope there is some
> way that I can reuse them without major rewrite of code. Anyway I have
> started to convert some of the simple one using the scout scheduler now.
>
> By the way, how do I change outline view in swt client? I try the
> OutlineViewButton approach suggested in another post, it work on swing
> client, but not in swt client.
Re: job scheduler with quartz [message #719825 is a reply to message #719314] Mon, 29 August 2011 07:01 Go to previous messageGo to next message
Li Hao is currently offline Li Hao
Messages: 28
Registered: August 2011
Junior Member
Thanks Andreas, I have test out the quartz in ServerApplication and it works. As for the outline switch, I try the treeform example and it works.

I try to add a action in the swt ui (not the client) to switch outline, I create a action for changing outline. Here is my code:

=========================================================
m_environment = Activator.getDefault().getEnvironment();
IDesktop desktop = m_environment.getScoutDesktop();

if(desktop.getAvailableOutlines().length > 1) {
IOutline m_outline = desktop.getAvailableOutlines()[1]; //get the second outline
}

m_outline.setVisible(true);
m_outline.setEnabled(true);

desktop.setOutline(m_outline);
========================================================
but I always get a null pointer exception at the last line:
desktop.setOutline(m_outline);

What am I missing here?

Re: job scheduler with quartz [message #719864 is a reply to message #719825] Mon, 29 August 2011 08:47 Go to previous messageGo to next message
Andreas Hoegger is currently offline Andreas Hoegger
Messages: 174
Registered: February 2010
Senior Member
Could you please provide the stack trace of the NPE?
-Andreas

On 29.08.2011 09:01, irheat wrote:
> Thanks Andreas, I have test out the quartz in ServerApplication and it
> works. As for the outline switch, I try the treeform example and it works.
> I try to add a action in the swt ui (not the client) to switch outline,
> I create a action for changing outline. Here is my code:
>
> =========================================================
> m_environment = Activator.getDefault().getEnvironment();
> IDesktop desktop = m_environment.getScoutDesktop();
>
> if(desktop.getAvailableOutlines().length > 1) {
> IOutline m_outline = desktop.getAvailableOutlines()[1]; //get the second
> outline
> }
>
> m_outline.setVisible(true);
> m_outline.setEnabled(true);
>
> desktop.setOutline(m_outline);
> ========================================================
> but I always get a null pointer exception at the last line:
> desktop.setOutline(m_outline);
>
> What am I missing here?
>
>
Re: job scheduler with quartz [message #719865 is a reply to message #719825] Mon, 29 August 2011 08:52 Go to previous messageGo to next message
Andreas Hoegger is currently offline Andreas Hoegger
Messages: 174
Registered: February 2010
Senior Member
Ensure to propagate your outlines on the desktop by:
Desktop{
@Override
protected Class<? extends IOutline>[] getConfiguredOutlines() {
return new Class[]{Test1Outline.class, Test2Outline.class};
}
}

-Andreas

On 29.08.2011 09:01, irheat wrote:
> Thanks Andreas, I have test out the quartz in ServerApplication and it
> works. As for the outline switch, I try the treeform example and it works.
> I try to add a action in the swt ui (not the client) to switch outline,
> I create a action for changing outline. Here is my code:
>
> =========================================================
> m_environment = Activator.getDefault().getEnvironment();
> IDesktop desktop = m_environment.getScoutDesktop();
>
> if(desktop.getAvailableOutlines().length > 1) {
> IOutline m_outline = desktop.getAvailableOutlines()[1]; //get the second
> outline
> }
>
> m_outline.setVisible(true);
> m_outline.setEnabled(true);
>
> desktop.setOutline(m_outline);
> ========================================================
> but I always get a null pointer exception at the last line:
> desktop.setOutline(m_outline);
>
> What am I missing here?
>
>
Re: job scheduler with quartz [message #719956 is a reply to message #719864] Mon, 29 August 2011 14:54 Go to previous messageGo to next message
Li Hao is currently offline Li Hao
Messages: 28
Registered: August 2011
Junior Member
All the outline is initialized in Desktop:
@Override
protected Class<? extends IOutline>[] getConfiguredOutlines() {
ArrayList<Class> outlines = new ArrayList<Class>();
outlines.add(ConfigureOutline.class);
outlines.add(ReportOutline.class);
outlines.add(OverviewOutline.class);
outlines.add(UserOutline.class);
return outlines.toArray(new Class[outlines.size()]);
}


Stack Trace is below, the first 3 lines are debug print out I generated before the setOutline call:

outlines: 4
buttons: 4
outline found: User
java.lang.NullPointerException
at org.eclipse.scout.rt.client.ui.desktop.AbstractDesktop.setOutline(Unknown Source)
at com.sageway.ems.ui.swt.application.ChangeOutlineAction.run(ChangeOutlineAction.java:65)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.sageway.ems.ui.swt.application.Application.startSecure(Application.java:48)
at com.sageway.ems.ui.swt.application.Application$1.run(Application.java:34)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Unknown Source)
at com.sageway.ems.ui.swt.application.Application.start(Application.java:32)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Re: job scheduler with quartz [message #720391 is a reply to message #719956] Tue, 30 August 2011 13:31 Go to previous messageGo to next message
Andreas Hoegger is currently offline Andreas Hoegger
Messages: 174
Registered: February 2010
Senior Member
I see our fault;) we did not provide debug information so far. May I ask
you to download 'Eclipse Indigo for RCP and RAP developers'
(http://www.eclipse.org/downloads/packages/eclipse-rcp-and-rap-developers/indigor)
and grab Scout 3.7.1 RC2 from p2 repository
(http://download.eclipse.org/scout/3.7.1/update/). And provide the stack
trace again.

-Andreas

On 29.08.2011 16:54, irheat wrote:
> All the outline is initialized in Desktop:
> @Override
> protected Class<? extends IOutline>[] getConfiguredOutlines() {
> ArrayList<Class> outlines = new ArrayList<Class>();
> outlines.add(ConfigureOutline.class);
> outlines.add(ReportOutline.class);
> outlines.add(OverviewOutline.class);
> outlines.add(UserOutline.class);
> return outlines.toArray(new Class[outlines.size()]);
> }
>
>
> Stack Trace is below, the first 3 lines are debug print out I generated
> before the setOutline call:
>
> outlines: 4
> buttons: 4
> outline found: User
> java.lang.NullPointerException
> at
> org.eclipse.scout.rt.client.ui.desktop.AbstractDesktop.setOutline(Unknown Source)
>
> at
> com.sageway.ems.ui.swt.application.ChangeOutlineAction.run(ChangeOutlineAction.java:65)
>
> at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
>
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
>
> at
> org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452)
>
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
> at
> com.sageway.ems.ui.swt.application.Application.startSecure(Application.java:48)
>
> at
> com.sageway.ems.ui.swt.application.Application$1.run(Application.java:34)
> at java.security.AccessController.doPrivileged(Native Method)
> at javax.security.auth.Subject.doAs(Unknown Source)
> at
> com.sageway.ems.ui.swt.application.Application.start(Application.java:32)
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Re: job scheduler with quartz [message #720436 is a reply to message #720391] Tue, 30 August 2011 15:24 Go to previous messageGo to next message
Li Hao is currently offline Li Hao
Messages: 28
Registered: August 2011
Junior Member
stack trace after install new version:

java.lang.NullPointerException
at org.eclipse.scout.rt.client.ui.desktop.AbstractDesktop.setOutline(AbstractDesktop.java:670)
at com.sageway.ems.ui.swt.application.ChangeOutlineAction.run(ChangeOutlineAction.java:65)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.sageway.ems.ui.swt.application.Application.startSecure(Application.java:48)
at com.sageway.ems.ui.swt.application.Application$1.run(Application.java:34)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Unknown Source)
at com.sageway.ems.ui.swt.application.Application.start(Application.java:32)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Re: job scheduler with quartz [message #720787 is a reply to message #720436] Wed, 31 August 2011 08:44 Go to previous messageGo to next message
Andreas Hoegger is currently offline Andreas Hoegger
Messages: 174
Registered: February 2010
Senior Member
Ok, you are calling the setOutline method directly from the UI thread.
Scout does provide a service context defining the scope of services.
Therefore services as used in
'AbstractDesktop.setOutline(AbstractDesktop.java:670)' are usually bound
to a context (See plugin.xml service extension).
Change you code to:

ISwtEnvironment env = Activator.getDefault().getEnvironment();
final IDesktop desktop = env.getScoutDesktop();
Runnable t = new Runnable() {
@Override
public void run() {
// your code here
if(desktop.getAvailableOutlines().length > 1) {
//get the second outline
IOutline outline = desktop.getAvailableOutlines()[1];
outline.setVisible(true);
outline.setEnabled(true);
desktop.setOutline(outline);
}
}
};
env.invokeScoutLater(t, 0);


Hope it helps.
-Andreas


On 30.08.2011 17:24, irheat wrote:
> stack trace after install new version:
>
> java.lang.NullPointerException
> at
> org.eclipse.scout.rt.client.ui.desktop.AbstractDesktop.setOutline(AbstractDesktop.java:670)
>
> at
> com.sageway.ems.ui.swt.application.ChangeOutlineAction.run(ChangeOutlineAction.java:65)
>
> at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
>
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
>
> at
> org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452)
>
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
> at
> com.sageway.ems.ui.swt.application.Application.startSecure(Application.java:48)
>
> at
> com.sageway.ems.ui.swt.application.Application$1.run(Application.java:34)
> at java.security.AccessController.doPrivileged(Native Method)
> at javax.security.auth.Subject.doAs(Unknown Source)
> at
> com.sageway.ems.ui.swt.application.Application.start(Application.java:32)
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Re: job scheduler with quartz [message #720964 is a reply to message #720787] Wed, 31 August 2011 15:15 Go to previous message
Li Hao is currently offline Li Hao
Messages: 28
Registered: August 2011
Junior Member
Thanks Andreas, it works great, now I have a similar interface for both swing and swt. The snapbox works also, but it is a bit small and located at the button, I think it is better to have a action button in the toolbar doing the outline change just like the swing interface.
Previous Topic:Debuggable code?
Next Topic:promised wicket integration?
Goto Forum:
  


Current Time: Fri Oct 31 09:18:56 GMT 2014

Powered by FUDForum. Page generated in 0.02688 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software