How to enable F5 for own view/explorer? - refresh

I have a view (ViewPart) based on my own objects (with an ITreeContentProvider). How can I enable the F5-key and the corresponding menu entry (File -> Refresh) for this view? Currently it's disabled.

The refresh action is a retargetable action with id IWorkbenchCommandConstants.FILE_REFRESH and usually implemented with org.eclipse.ui.actions.RefreshAction. So something like this in your ViewPart:
RefreshAction refreshResourcesAction = new RefreshAction(getViewSite());
refreshResourcesAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_REFRESH);
IActionBars bars = getViewSite().getActionBars();
bars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshResourcesAction);
RefreshAction expects the selection to be IResource based objects - if that is not the case in your view you will have to do more work.

Related

Acumatica-LotSerialNbrAttribute screen on mobile app

I'm using Acumatica customization Acumatica-LotSerialNbrAttribute
This customization adds a new screen for look for InventoryID and LotSerialNbr and visualize its attributes.
I'm trying to add this window to the acumatica mobile app.
Here my code:
add screen IN202501 {
add container "InventoryLotSerialContainers" {
add field "InventoryID"
add field "LotSerialNbr"
add group "Attributes" {
displayName = "Attributes"
collapsable = True
add attributes "AttributesAttributes"
}
add recordAction "Save" {
behavior = Save
}
add recordAction "Cancel" {
behavior = Cancel
}
attachments {
}
}
}
And the screen is visible on the mobile app with the 2 selectors
Then I select Inventory and when I select Lot Serial Nbr, the first selector is in blank, causing that I can't review the attributtes neither save the information.
Here the InventoryID selector in blank.
Hope you can help me to successfully publish this screen on acumatica mobile app.
Thanks.
Attributes are a grid style representation in Acumatica. That means you need a container that will show multiple records. I'm getting rusty on mobile pretty quickly, but I believe your definition is set to display a single value value only.
Try adding a separate container for attributes:
add container "AttributesAttributes" {
add field "Attribute"
add field "Value"
}
This should open into a view of multiple records, showing all of your attributes. By specifying the Attribute and Value fields, you should see both data elements in the container.

Acumatica - How to change the page opened by the edit button (pencil)

I'm trying to customize a page so that the edit button (the pencil icon one) directs the user to a specific page. In my case, the edit button is linked to a BAccountID field :
By default, it opens the Business Account's page (page CR303000):
I would like it to open a different page that I created that has a similar BAccount view (page AR303001) :
Can this be done ? And how ? I can't seem to find the code behind this logic.
The target graph is declared in the PXPrimaryGraph attribute decorating the DAC.
BAccount DAC is a special case that uses a more complex attribute (CRCacheIndependentPrimaryGraphList) that inherits from PXPrimaryGraph.
[CRCacheIndependentPrimaryGraphList(new Type[]{
typeof(CR.BusinessAccountMaint),
typeof(EP.EmployeeMaint),
typeof(AP.VendorMaint),
typeof(AP.VendorMaint),
typeof(AR.CustomerMaint),
typeof(AR.CustomerMaint),
typeof(AP.VendorMaint),
typeof(AR.CustomerMaint),
typeof(CR.BusinessAccountMaint)},
new Type[]{
typeof(Select<CR.BAccount, Where<CR.BAccount.bAccountID, Equal<Current<BAccount.bAccountID>>,
And<Current<BAccount.viewInCrm>, Equal<True>>>>),
typeof(Select<EP.EPEmployee, Where<EP.EPEmployee.bAccountID, Equal<Current<BAccount.bAccountID>>>>),
typeof(Select<AP.VendorR, Where<AP.VendorR.bAccountID, Equal<Current<BAccount.bAccountID>>>>),
typeof(Select<AP.Vendor, Where<AP.Vendor.bAccountID, Equal<Current<BAccountR.bAccountID>>>>),
typeof(Select<AR.Customer, Where<AR.Customer.bAccountID, Equal<Current<BAccount.bAccountID>>>>),
typeof(Select<AR.Customer, Where<AR.Customer.bAccountID, Equal<Current<BAccountR.bAccountID>>>>),
typeof(Where<CR.BAccountR.bAccountID, Less<Zero>,
And<BAccountR.type, Equal<BAccountType.vendorType>>>),
typeof(Where<CR.BAccountR.bAccountID, Less<Zero>,
And<BAccountR.type, Equal<BAccountType.customerType>>>),
typeof(Select<CR.BAccount,
Where2<Where<
CR.BAccount.type, Equal<BAccountType.prospectType>,
Or<CR.BAccount.type, Equal<BAccountType.customerType>,
Or<CR.BAccount.type, Equal<BAccountType.vendorType>,
Or<CR.BAccount.type, Equal<BAccountType.combinedType>>>>>,
And<Where<CR.BAccount.bAccountID, Equal<Current<BAccount.bAccountID>>,
Or<Current<BAccount.bAccountID>, Less<Zero>>>>>>)
},
VerifyRightsBy = new [] { typeof(CR.BusinessAccountMaint) })]
There is no way to easily customize this attribute. To change it would you need to replace the BAccount DAC with another one. The preferred method for your use case is to avoid usage PXPrimaryGraph attribute by using a regular action button.
The action button can be configured to show the pencil icon:
Make PXButton appear as pencil icon
And it can be displayed beside the field using PXLayout Merge property or you can use LinkCommand to redirect:
https://stackoverflow.com/a/60446714/7376238

Disabling/Enabling a oracle apex Tabular Form Attribute based on the value selected in another attribute

I have a tabular form attribute which is a select list with static values Yes/no and another 2 attributes of Date and display.
My requirement is when i select "No" from the Select List, Date attribute should be enabled and Display attribute should be Disabled and If "Yes" From select list Display attribute should be enabled and Date attribute should be Disabled.
Dynamic Action:
Created a Dynamic action:
event = Change
Selection Type = Jquery selector
Jquery selector = `select[name='f06']`
Action = Execute javascript Code
var el = this.triggeringElement.id;
var row = el.split("_")[1];
if ($v(el) == "N") {
// disable the field
$x_disableItem("f04_" + row, true);
}
else {
// enable the field
$x_disableItem("f04_" + row, false);
}
Dynamic action Working perfectly for already created Rows, But not while i am trying to add new Row by selecting Add row.
https://apex.oracle.com/pls/apex/f?p=38210:LOGIN_DESKTOP:115699939041356
App 38210. Apex 4.2.6
Workspace/username/password : nani4850
Kindly help me out experts!!
Adding a blank row involves a partial page refresh, so the Event Scope of your dynamic action needs to be changed from Static to Dynamic in order for the change event handler to remain bound to the triggering elements.
You'll now find you have problems submitting new records, but if you're having difficulty, that's for another question!

how to display an accelerator for a Gio.MenuItem

I'm trying to display the shortcut key accelerator for a Gio.Menuitem
As you can see, the RandomAlbum menu item does not have an accelerator displayed - however, I have added added the accelerator and connected it to the Gio.MenuItem successfully because the menuitem responds to the keyboard shortcut Alt+Z
The snippet of code I'm using is as follows:
action = Gio.SimpleAction.new(action_name, None)
app = Gio.Application.get_default()
app.add_accelerator("<alt>Z", "app."+action_name, None)
item = Gio.MenuItem()
item.set_detailed_action('app.' + action_name)
item.set_label("RandomAlbum")
app.add_plugin_menu_item('tools', "unique name", item)
Any ideas why the accelerator does not display - but still responds to keyboard control?
The full source is here:
https://github.com/fossfreedom/Rhythmbox-Random-Album-Player
The missing piece of this jigsaw puzzle is realising that Gio.MenuItems themselves have attribute-values.
So in this case, before adding the menu-item to the GMenu the syntax required is:
item.set_attribute_value("accel", GLib.Variant("s", "<Alt>Z"))
To complete the answer, you can also set the label and action for the menu-item in this way:
item = Gio.MenuItem()
item.set_attribute_value("label", GLib.Variant("s", "RandomAlbum"))
item.set_attribute_value("action", GLib.Variant("s", "app."+action_name))
However the methods set_label and set_detailed_action perform the same role.

How to split a Window dynamically in MFC without using CSplitterWnd::Create

I create a MFC MDI application, and want to split a window into two parts at a time dynamically by right click and choosing a "AddSplitWnd" pop menu item. I try to use CSplitterWnd::CreateStatic to implement it, once the window is split, it need to create a new view, but I want to use the previous view instead, so does anyone know how to implement it. Thank you.
Here is a code snippet to exchange views in a splitter in a SDI environment. This should be adaptable to work in MDI as well.
CView* CDoc::SwitchToView(CView* pNewView)
{
CFrameWndEx* pMainWnd = (CFrameWndEx*)AfxGetMainWnd();
CView* pOldActiveView;
pOldActiveView = pMainWnd->GetActiveView();
CSplitterWnd* pSplitter = (CSplitterWnd *)pOldActiveView->GetParent();
// in this case Pane 0,0 is exchanged
pOldActiveView = (CView*) pSplitter->GetPane(0,0);
// set flag so that document will not be deleted when view is destroyed
m_bAutoDelete = FALSE;
// Dettach existing view
RemoveView(pOldActiveView);
// set flag back to default
m_bAutoDelete = TRUE;
// Set the child window ID of the active view to the ID of the corresponding
// pane. Set the child ID of the previously active view to some other ID.
::SetWindowLong(pOldActiveView->m_hWnd, GWL_ID, 0);
::SetWindowLong(pNewView->m_hWnd, GWL_ID, pSplitter->IdFromRowCol(0,0));
// Show the newly active view and hide the inactive view.
pNewView->ShowWindow(SW_SHOW);
pOldActiveView->ShowWindow(SW_HIDE);
// Attach new view
AddView(pNewView);
// Set active
pSplitter->GetParentFrame()->SetActiveView(pNewView);
pSplitter->RecalcLayout();
return pOldActiveView;
}
HTH