I found that E4 model does not synchronize widget status
e.g.
shell.getVisible() == false
But the model is true
My understanding is that the E4 model will not listen to the SWT.Show and SWT.Hide events of Control. If you directly set the visible of control, the E4 model will not be updated synchronously
I'm not sure if my understanding is correct. I'm still learning E4
Related
I am porting an existing Eclipse plug-in to e4. From within a non-ported IViewPart I would like to access the view’s corresponding e4 MPart but couldn’t get the following to work reliably:
EPartService partService = (EPartService) PlatformUI.getWorkbench().getService(EPartService.class);
MPart part = partService.findPart(getSite().getId());
Placed in createPartControlComposite)
I sometimes get an IllegalStateException (“Application does not have an active window“).
Avoid using the part service from the workbench as this only works when there is an active window.
Instead use the part service for the current window (which might not be active). You can get this in the IViewPart using:
EPartService partService = getSite().getService(EPartService.class);
MPart part = partService.findPart(getSite().getId());
I have 3 jobs configured on jenkins build flow and the desired activity is to get dynamic variables resulted from post-build task of b1 to b2 and variables of b2 to b3 and so on so forth.
list = ["foo", "bar"]
b1 = build("ExecuteJob1", param1: list[idx])
b2 = build("ExecuteJob2", param1: <some dynamic variable from b1>)
b3 = build("ExecuteJob3", param1: <some dynamic variable from b2>, param2: some dynamic variable from b1)
As specified above, there are dynamic variables generated by each previous job (as a part of post build action - I'm using description setter plugin in one instance to generate one dynamic variable and other I want BUILD_URL of b1 to be used in b3)
In order to accomplish this, I came across a post present in this link and used EnvInject Plugin. Using this I performed the following -
I created a job (envInj) in order to inject those dynamic variables into environment
I used that envInj job as post-condition job for b1 and given some time out between b1 and b2 to make sure post-condition job executes before b2 begins.
This actually injects the variables required to environment (if checked in console logs as well as environment variables of envInj job).
But the issue I am facing is that those newly injected variables are not available for b2 to access and the same case for b3.
So, is there any option to get those b1 variables to b2 (so on and so forth) or is there any better way to achieve the desired ?
I got solution for the above question, as specified by #Dave Bacher in the above link,
I dumped the parameters to a file using batch script in Post Build Task plugin.
This file was injected back to environment using EvnInj plugin.
This allowed me to access those parameters in other jobs of build flow
b1 = build("ExecuteJob1", param1: list[idx])
b2 = build("ExecuteJob2", param1: b1.dynamicVariableX)
b3 = build("ExecuteJob3", param1: b1.dynamicVariableY, param2:nb2.dynamicVariableZ)
This works perfectly allowing to access dynamic variables through environment
I am using Ninject 3.2.0.0 with Ninject.Extension.Factory 3.2.0.0 in a webforms application.
I am getting error reports of the following...
Error loading Ninject component IAdviceRegistry
No such component has been registered in the kernel's component container.
Suggestions:
1) If you have created a custom subclass for KernelBase, ensure that you have properly
implemented the AddComponents() method.
2) Ensure that you have not removed the component from the container via a call to RemoveAll().
3) Ensure you have not accidentally created more than one kernel.
at Ninject.Components.ComponentContainer.Get(Type component) in c:\Projects\Ninject\ninject\src\Ninject\Components\ComponentContainer.cs:line 162
at Ninject.Components.ComponentContainer.GetT in c:\Projects\Ninject\ninject\src\Ninject\Components\ComponentContainer.cs:line 116
at Ninject.Extensions.Interception.Activation.Strategies.ProxyActivationStrategy.ShouldProxy(IContext context) in c:\Projects\Ninject\ninject.extensions.interception\src\Ninject.Extensions.Interception\Activation\Strategies\ProxyActivationStrategy.cs:line 66
at Ninject.Extensions.Interception.Activation.Strategies.ProxyActivationStrategy.Deactivate(IContext context, InstanceReference reference) in c:\Projects\Ninject\ninject.extensions.interception\src\Ninject.Extensions.Interception\Activation\Strategies\ProxyActivationStrategy.cs:line 51
at Ninject.Activation.Pipeline.<>c__DisplayClass6.b__4(IActivationStrategy s) in c:\Projects\Ninject\ninject\src\Ninject\Activation\Pipeline.cs:line 72
at Ninject.Infrastructure.Language.ExtensionsForIEnumerableOfT.Map[T](IEnumerable1 series, Action1 action) in c:\Projects\Ninject\ninject\src\Ninject\Infrastructure\Language\ExtensionsForIEnumerableOfT.cs:line 31
at Ninject.Activation.Pipeline.Deactivate(IContext context, InstanceReference reference) in c:\Projects\Ninject\ninject\src\Ninject\Activation\Pipeline.cs:line 74
at Ninject.Activation.Caching.Cache.Forget(CacheEntry entry) in c:\Projects\Ninject\ninject\src\Ninject\Activation\Caching\Cache.cs:line 254
at Ninject.Activation.Caching.Cache.Forget(IEnumerable`1 cacheEntries) in c:\Projects\Ninject\ninject\src\Ninject\Activation\Caching\Cache.cs:line 240
at Ninject.Activation.Caching.Cache.Clear(Object scope) in c:\Projects\Ninject\ninject\src\Ninject\Activation\Caching\Cache.cs:line 198
at Ninject.Activation.Caching.Cache.<>c__DisplayClass3.b__1(Object o, EventArgs e) in c:\Projects\Ninject\ninject\src\Ninject\Activation\Caching\Cache.cs:line 94
at Ninject.Activation.Blocks.ActivationBlock.Dispose(Boolean disposing) in c:\Projects\Ninject\ninject\src\Ninject\Activation\Blocks\ActivationBlock.cs:line 59
at Ninject.Infrastructure.Disposal.DisposableObject.Dispose() in c:\Projects\Ninject\ninject\src\Ninject\Infrastructure\Disposal\DisposableObject.cs:line 33
at Brightspot.WebApi.Ioc.NinjectDependencyScope.Dispose()
at System.Net.Http.HttpRequestMessageExtensions.DisposeRequestResources(HttpRequestMessage request)
Make sure the extensions
ninject.extensions.interception
Ninject.Extensions.Interception.DynamicProxy
or the extensions
ninject.extensions.interception
Ninject.Extensions.Interception.Linfu
are present.
EDIT:
The registration of the IAdviceRegistry is part of the InterceptionModule of the ninject.extensions.interception extension.
So the extension is not loaded properly.
This is either because the extension dll was not properly copied to the output path / deployment path or (most likely issue) or you have configured the kernel to not autoload extensions / not do it correctly.
If you're using the StandardKernel without modifying any settings you should be good. However changing INinjectSettings.LoadExtensions = false or changing INinjectSettings.ExtensionSearchPatterns can break things.
Finally I found that issue.If we use factory pattern load the functional module in ninject. The functional module not loaded properly while using factory pattern. So you need to load the functional module in ninject.. And access the factory class using standard kernel...
this.Kernel.Load(new[] { new FuncModule() });
StandardKernel.Get<IApproveContextFactory>()
For a project, I have a complex master object that contains a number of subcomponents. Set up of these objects is controlled by a Constructor interface, which I bind to various lifecycle & workflow events, like so:
#grok.subscribe(schema.ICustomFolder, lifecycleevent.IObjectAddedEvent)
def setup_custom_folder(folder, event):
interfaces.IConstructor(folder).setup()
#grok.subscribe(schema.ICustomFolder, lifecycleevent.IObjectModifiedEvent)
def setup_custom_folder(folder, event):
interfaces.IConstructor(folder).update()
What I'd like to be able to do is test the Constructor methods without relying on the event handlers. I've tried doing this by creating objects directly to avoid the lifecycle events:
def test_custom_item_constructor(self):
master = createContent('model.master_object',
needed_attribute = 2
)
folder = createContent('model.custom_folder',
__parent__ = master
)
self.assertEqual(0, len(folder))
constructor = interfaces.IConstructor(folder)
constructor.setup()
self.assertEqual(2, len(folder))
The setup method creates a number of items inside the Custom_Folder instance, dependent on the provided attribute on the master object. However, this is hanging, which I think is due to neither object actually belonging to the site, so there's no acquisition of permissions. I can get this by changing the createContent on the master object to createContentInContainer and adding it to the appropriate part of the test site, but that triggers all of the lifecycle events, which end up doing the Constructor calls, which doesn't let me test them in isolation.
I've tried using mock objects for this, but that got messy dealing with the content creation that is meant to occur during the Constructor .setup.
What's the best way to approach this?
I'm not sure if this is the best way, but I managed to get the result I wanted by disabling the relevant event handlers first, and then creating the content properly within the site:
def test_custom_item_constructor(self):
zope.component.getGlobalSiteManager().unregisterHandler(
adapters.master.constructor.setup_masterobject,
required=[schema.IMasterObject, lifecycleevent.IObjectAddedEvent]
)
zope.component.getGlobalSiteManager().unregisterHandler(
adapters.custom.constructor.setup_customfolder,
required=[schema.ICustomFolder, lifecycleevent.IObjectAddedEvent]
)
master = createContentInContainer(self.portal, 'model.master_object',
needed_attribute = 2
)
folder = createContentInContainer(master, 'model.custom_folder',
__parent__ = master
)
self.assertEqual(0, len(folder))
constructor = interfaces.IConstructor(folder)
constructor.setup()
self.assertEqual(2, len(folder))
This was enough to disengage the chain of events triggered by the addition of a new master object.
Here is my basic situation. I'm trying to use NHibernate to get information from a database, create some objects based off the mappings, serialize, them, and the move the serialized object on to a flash component. No build errors are going off, but when I return the 'serialized' object it keeps returning null. Upon inserting some breakpoints and stepping through, I realized where everything was going south.
I put my break point in here:
var tasks = (List<CSH_Task>)persistanceManager.RetrieveAll<CSH_Task>(SessionAction.BeginAndEnd);
And it goes into my PersistanceManager class, successfully passing my CSH_Task:
public IList<T> RetrieveAll<T>(SessionAction sessionAction)
{
/* Note that NHibernate guarantees that two object references will point to the
* same object only if the references are set in the same session. For example,
* Order #123 under the Customer object Able Inc and Order #123 in the Orders
* list will point to the same object only if we load Customers and Orders in
* the same session. If we load them in different sessions, then changes that
* we make to Able Inc's Order #123 will not be reflected in Order #123 in the
* Orders list, since the references point to different objects. That's why we
* maintain a session as a member variable, instead of as a local variable. */
// Open a new session if specified
if ((sessionAction == SessionAction.Begin) || (sessionAction == SessionAction.BeginAndEnd))
{
m_Session = m_SessionFactory.OpenSession();
}
// Retrieve all objects of the type passed in
ICriteria targetObjects = m_Session.CreateCriteria(typeof(T));
IList<T> itemList = targetObjects.List<T>();
// Close the session if specified
if ((sessionAction == SessionAction.End) || (sessionAction == SessionAction.BeginAndEnd))
{
m_Session.Close();
m_Session.Dispose();
}
// Set return value
return itemList;
}
Which is straight from an older example of NHibernate(I'm extremely new to it)
And it drops me into a "No Source Available" Page, which lists this
Call stack location:
Iesi.Collections.DLL!Iesi.Collections.Generic.HashedSet.HashedSet()
Line 18
Source file information:
Locating source for
'd:\CSharp\NH\NH_Hg\nhibernate\src\Iesi.Collections\Generic\HashedSet.cs'.
Checksum: MD5 {d3 1c 6c 95 94 c0 cb d4 b5 8d 8c 42 c5 4a 37 b2}
The file 'd:\CSharp\NH\NH_Hg\nhibernate\src\Iesi.Collections\Generic\HashedSet.cs'
does not exist.
Looking in script documents for 'd:\CSharp\NH\NH_Hg\nhibernate\src\Iesi.Collections\Generic\HashedSet.cs'...
Looking in the projects for 'd:\CSharp\NH\NH_Hg\nhibernate\src\Iesi.Collections\Generic\HashedSet.cs'.
The file was not found in a project.
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\atl\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\'... Looking in directory 'C:\Users\tackiean\Desktop\'...
Looking in directory 'E:\SmartMC\NHibernate\Required_Bins\'...
Source was found at 'E:\SmartMC\NHibernate\Required_Bins\HashedSet.cs'.
Determining whether the checksum matches for the following locations:
1:E:\SmartMC\NHibernate\Required_Bins\HashedSet.cs Checksum: MD5 {40 1b
39 7e 8f 4a 3f 6 11 41 88 70 9e 8f 8 f1} Checksum doesn't match.
The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: d:\CSharp\NH\NH_Hg\nhibernate\src\Iesi.Collections\Generic\HashedSet.cs.
The debugger could not locate the source file 'd:\CSharp\NH\NH_Hg\nhibernate\src\Iesi.Collections\Generic\HashedSet.cs'.
If I keep stepping through it returns to my code, then back here listing a virtually identical message about DictionarySet.cs
I am not the one who downloaded NHibernate for this project on this machine in the first place, but I would have imagined that if HashedSet.cs/DictionarySet.cs were required for it to work, they would have been included by default no? I've spent the last about 7 hours today looking for answer to this, but am coming up empty. I have never seen an error like this before. I think its just looking for a file that NHibernate needs, and can't find, but is something else going on here? Any help would be sorely appreciated. I hope this an appropriate location/formatted legibly; I've never asked a question on here before so I hope it's not completely inappropriate.
HashedSet and DictionarySet are part of Iesi.Collections, a collection library included with NHibernate. The binary package of NHibernate usually includes the .pdb files, that contain the debug information of the assemblies. When the debugger wants to open the source files, it can't find them on your machine, because the included source paths are that of the package maintainers.
If you wish to, you can download the NHibernate sources at GitHub and compile the assemblies by yourself. Then the debugger will automatically find the source files, when an exception occurs (do not move the source files after compilation).
You should modify your RetrieveAll method a bit, because you have to always open a session and close it somewhere. Normally, you do something like:
using (ISession sess = factory.OpenSession())
using (ITransaction tx = sess.BeginTransaction())
{
try
{
var crit = sess.CreateCriteria<T>();
var list = crit.List<T>();
// Do something with list
tx.Commit();
}
catch (Exception)
{
tx.Rollback();
}
}
If you want to return the queried list to the caller, the session will be closed. So make sure, that there are no uninitalized lazy loading proxies left in your queried list. You may read the lazy/eager loading section in the NHibernate documentation. Hope, I could help a bit with your problem.
The messages you see are your debugger trying to find the source code since you are stepping through it. The lack of that source code on your machine does not effect NHibernate runtime.