public void customResultAvailable(Object result) { final ISettingsService settings = (ISettingsService)result; mpanel.getProperties().addResultListener(new SwingDelegationResultListener(ret) { public void customResultAvailable(Object result) { final Properties props = new Properties(); props.addSubproperties("mpanel", (Properties)result); tcpanel.getProperties().addResultListener(new SwingDelegationResultListener(ret) { public void customResultAvailable(Object result) { props.addSubproperties("tcpanel", (Properties)result); settings.setProperties("TestCenterPlugin", props) .addResultListener(new SwingDelegationResultListener(ret)); } }); } }); }
public void run() { customCommandAvailable(command); } });
public void run() { customExceptionOccurred(exception); } });
public void run() { try { customResultAvailable(result); } catch(Exception e) { // Could happen that overridden customResultAvailable method // first sets result and then throws exception (listener ex are catched). future.setExceptionIfUndone(e); // if(undone) // { // future.setExceptionIfUndone(e); // } // else // { // future.setException(e); // } } } });
/** * Called when the result is available. * @param result The result. */ public void resultAvailableIfUndone(E result) { undone = true; resultAvailable(result); }
/** * Called when an exception occurred. * @param exception The exception. */ public void exceptionOccurredIfUndone(Exception exception) { undone = true; exceptionOccurred(exception); }
public void customResultAvailable(Object result) { final ISettingsService settings = (ISettingsService)result; mpanel.getProperties().addResultListener(new SwingDelegationResultListener(ret) { public void customResultAvailable(Object result) { final Properties props = new Properties(); props.addSubproperties("mpanel", (Properties)result); tcpanel.getProperties().addResultListener(new SwingDelegationResultListener(ret) { public void customResultAvailable(Object result) { props.addSubproperties("tcpanel", (Properties)result); settings.setProperties("TestCenterPlugin", props) .addResultListener(new SwingDelegationResultListener(ret)); } }); } }); }
/** * Called when an exception occurred. * @param exception The exception. */ final public void exceptionOccurred(final Exception exception) { // exception.printStackTrace(); // Hack!!! When triggered from shutdown hook, swing might be terminated // and invokeLater has no effect (grrr). if(!SReflect.HAS_GUI || SwingUtilities.isEventDispatchThread())// || Starter.isShutdown()) // if(SwingUtilities.isEventDispatchThread()) { customExceptionOccurred(exception); } else { SwingUtilities.invokeLater(new Runnable() { public void run() { customExceptionOccurred(exception); } }); } }
/** * Called when a command is available. */ final public void commandAvailable(final Object command) { // Hack!!! When triggered from shutdown hook, swing might be terminated // and invokeLater has no effect (grrr). if(!SReflect.HAS_GUI || SwingUtilities.isEventDispatchThread())// || Starter.isShutdown()) // if(SwingUtilities.isEventDispatchThread()) { customCommandAvailable(command); } else { // Thread.dumpStack(); SwingUtilities.invokeLater(new Runnable() { public void run() { customCommandAvailable(command); } }); } }
public void customResultAvailable(Object result) { // System.out.println("fetching mpanel properties"); final ISettingsService settings = (ISettingsService)result; mpanel.getProperties().addResultListener(new SwingDelegationResultListener(ret) { public void customResultAvailable(Object result) { // System.out.println("fetched mpanel properties"); final Properties props = new Properties(); props.addSubproperties("mpanel", (Properties)result); spanel.getProperties().addResultListener(new SwingDelegationResultListener(ret) { public void customResultAvailable(Object result) { // System.out.println("fetched spanel properties"); props.addSubproperties("spanel", (Properties)result); settings.setProperties("StarterServicePanel", props) .addResultListener(new SwingDelegationResultListener(ret)); } }); } }); }
public void customResultAvailable(Object result) { // System.out.println("fetching mpanel properties"); final ISettingsService settings = (ISettingsService)result; mpanel.getProperties().addResultListener(new SwingDelegationResultListener(ret) { public void customResultAvailable(Object result) { // System.out.println("fetched mpanel properties"); final Properties props = new Properties(); props.addSubproperties("mpanel", (Properties)result); spanel.getProperties().addResultListener(new SwingDelegationResultListener(ret) { public void customResultAvailable(Object result) { // System.out.println("fetched spanel properties"); props.addSubproperties("spanel", (Properties)result); settings.setProperties("StarterServicePanel", props) .addResultListener(new SwingDelegationResultListener(ret)); } }); } }); }
public void customResultAvailable(Object result) { ISettingsService settings = (ISettingsService)result; settings.getProperties("TestCenterPlugin") .addResultListener(new SwingDelegationResultListener(ret) { public void customResultAvailable(Object result) { if(result!=null) { final Properties props = (Properties)result; mpanel.setProperties(props.getSubproperty("mpanel")) .addResultListener(new SwingDelegationResultListener(ret) { public void customResultAvailable(Object result) { tcpanel.setProperties(props.getSubproperty("tcpanel")) .addResultListener(new SwingDelegationResultListener(ret)); } }); } else { ret.setResult(null); } } }); }
public void customResultAvailable(Object result) { ISettingsService settings = (ISettingsService)result; settings.getProperties("TestCenterPlugin") .addResultListener(new SwingDelegationResultListener(ret) { public void customResultAvailable(Object result) { if(result!=null) { final Properties props = (Properties)result; mpanel.setProperties(props.getSubproperty("mpanel")) .addResultListener(new SwingDelegationResultListener(ret) { public void customResultAvailable(Object result) { tcpanel.setProperties(props.getSubproperty("tcpanel")) .addResultListener(new SwingDelegationResultListener(ret)); } }); } else { ret.setResult(null); } } }); }
public void customResultAvailable(Object result) { List children = (List)result; final List list = new ArrayList(); CounterResultListener crl = new CounterResultListener(children.size(), new SwingDelegationResultListener(fut) { public void customResultAvailable(Object result) { fut.setResult(list); } }) { public void intermediateResultAvailable(Object result) { list.addAll((Collection)result); } }; for(int i=0; i<children.size(); i++) { getLeafChildren((IFileNode)children.get(i)).addResultListener(crl); } } });
public void customResultAvailable(Object result) { List children = (List)result; final List list = new ArrayList(); CounterResultListener crl = new CounterResultListener(children.size(), new SwingDelegationResultListener(fut) { public void customResultAvailable(Object result) { fut.setResult(list); } }) { public void intermediateResultAvailable(Object result) { list.addAll((Collection)result); } }; for(int i=0; i<children.size(); i++) { getLeafChildren((IFileNode)children.get(i)).addResultListener(crl); } } });
/** * Shutdown the plugin. */ public IFuture<Void> shutdown() { final Future<Void> ret = new Future<Void>(); comptree.dispose(); CounterResultListener<Void> lis = new CounterResultListener<Void>(panels.size(), true, new SwingDelegationResultListener<Void>(ret)); for(Iterator<IAbstractViewerPanel> it=panels.values().iterator(); it.hasNext(); ) { it.next().shutdown().addResultListener(lis); } return ret; }
public void customResultAvailable(Object result) { ISettingsService settings = (ISettingsService)result; settings.getProperties("StarterServicePanel") .addResultListener(new SwingDelegationResultListener(ret) { public void customResultAvailable(Object result) { if(result!=null) { final Properties props = (Properties)result; mpanel.setProperties(props.getSubproperty("mpanel")) .addResultListener(new SwingDelegationResultListener(ret) { public void customResultAvailable(Object result) { spanel.setProperties(props.getSubproperty("spanel")) .addResultListener(new DelegationResultListener(ret)); } }); } else { ret.setResult(null); } } }); }
public void customResultAvailable(Object result) { ISettingsService settings = (ISettingsService)result; settings.getProperties("StarterServicePanel") .addResultListener(new SwingDelegationResultListener(ret) { public void customResultAvailable(Object result) { if(result!=null) { final Properties props = (Properties)result; mpanel.setProperties(props.getSubproperty("mpanel")) .addResultListener(new SwingDelegationResultListener(ret) { public void customResultAvailable(Object result) { spanel.setProperties(props.getSubproperty("spanel")) .addResultListener(new DelegationResultListener(ret)); } }); } else { ret.setResult(null); } } }); }
/** * Shutdown the plugin. */ public IFuture<Void> shutdown() { final Future<Void> ret = new Future<Void>(); comptree.dispose(); CounterResultListener<Void> lis = new CounterResultListener<Void>(msgservices.values().size(), true, new SwingDelegationResultListener<Void>(ret)); for(Iterator it=msgservices.values().iterator(); it.hasNext(); ) { Object[] entry = (Object[])it.next(); ((IMessageService)entry[0]).removeMessageListener(listener).addResultListener(lis); } return ret; }