How to add a seperator between two TreeTable ini jface - treeview

I have created an eclipse plugin project using one of the sample templates available. I want to have two viewers side by side. I am able to accomplish this. But the thing is..there is no seperator as such. It basically looks like this:
TreeViewer1 TreeViewer2
. .
....comp1 ....Comp3
. .
....comp2 ....Comp4
I want to have it something like this:
TreeViewer1 | TreeViewer2
. | .
....comp1 | ....Comp3
. | .
....comp2 | ....Comp4
I tried adding 'new Label(parent, SWT.SEPARATOR | SWT.VERTICAL);' But the UI entirely got messed up.
This is the code
public void createPartControl(Composite parent)
{
viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL
| SWT.V_SCROLL);
viewer.setContentProvider(new ViewContentProvider());
viewer.setLabelProvider(new ViewLabelProvider());
// Provide the input to the ContentProvider
viewer.setInput(new String[] {"One", "Two", "Three"});
new Label(parent, SWT.SEPARATOR | SWT.VERTICAL);
viewer2 = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL
| SWT.V_SCROLL);
viewer2.setContentProvider(new ViewContentProvider());
viewer2.setLabelProvider(new ViewLabelProvider());
// Provide the input to the ContentProvider
viewer2.setInput(new String[] {"One", "Two", "Three"});
}
Requesting you to share your thoughts.
Thanks,
Pavan.

You need to set LayoutData properly on every Control.
Start Reading this standard article about layout managers in SWT
http://www.eclipse.org/articles/article.php?file=Article-Understanding-Layouts/index.html

Related

Gatsby queries error with multiple queries error [duplicate]

To create the post template through this tutorial(I'm in part 4):
https://www.joaopedro.cc/blog-com-gatsby-e-react-parte-4
But when doing the "PostPage" query an error is occurring:
Multiple "root" queries found: "PostPage" and "PostPage".
Only the first ("PostPage") will be registered.
Instead of:
1 | query PostPage {
2 | markdownRemark {
3 | #...
4 | }
5 | }
6 |
7 | query PostPage {
8 | markdownRemark {
9 | #...
10 | }
11 | }
Do:
1 | query postPageAndPostPage {
2 | markdownRemark {
3 | #...
4 | }
5 | markdownRemark {
6 | #...
7 | }
8 | }
I've looked at other answers to similar questions, and from what I understand it was a case sensitive issue, but from what I see, everything is looking correct.
I'm not getting out of place. :( thanks in advance!
The error message here is actually quite helpful, but it doesn't take it all the way.
The issue is that you can only have a single query and you have multiple. The solution is to query for all the data you need in a single query rather than splitting it across multiple, as the error suggests.
Alas, you're trying to fetch what I imagine are two distinct data sets through the same field, which will give you another error by default. But there's an easy solution here: use aliases to de-duplicate the field name in the result.
query PostPage {
firstPost: markdownRemark {
#...
}
secondPost: markdownRemark {
#...
}
}
I had the same error today on Gatsby. There was one page Query and one Static Query used so the message was a bit misleading.
"This can happen when you use two page/static queries in one file"
The way this was tackled was I traced down the files that were using it. One of them was present but notice it was NOT in any way active in the project. Once it was removed the alert disappeared. So, in a nutshell, even if the file is NOT used anywhere the second identical Static Query is picked up.
In my case it was about having identical names of two page queries in two different pages.
Here's my setup:
in the pages folder, I have two components - index.tsx and account.tsx
both these components have this page query:
export const query = graphql`
query myquery($pathname: String) {
myquery(page: { eq: $pathname }) {
id
title
page
description
}
}
`
I got the error mentioned in the question
So, it turned out two queries in two different files but with the same name is forbidden.
In the end, I just used two different query names in my two files - myquery and myotherquery. Voila!
I just ran into the same error message with a React component that only used one StaticQuery. This component was copied in from another project (where it is working without any issues).
I've looked at other answers to similar questions, and from what I understand it was a case-sensitive issue...
This helped me to solve it - turned out that both the name of the React component as well as the StaticQuery were not propper camelCased (they contained "SEO" - all capital letters).
Error message is gone after cleaning this part up. I thought I share this as I found the error message in this context confusing.
ERROR #85910 GRAPHQL
Multiple "root" queries found: "SEOQuery" and "SEOQuery".
Only the first ("SEOQuery") will be registered.
Instead of:
1 | query SEOQuery {
2 | site {
3 | #...
4 | }
5 | }
6 |
7 | query SEOQuery {
8 | site {
9 | #...
10 | }
11 | }
Do:
1 | query seoQueryAndSeoQuery {
2 | site {
3 | #...
4 | }
5 | site {
6 | #...
7 | }
8 | }

PowerShell - How to count objects?

I am using PowerShell to build some scripts in an Active Directory enviroment and am currently struggling to find a way to count objects. My base search is:
$DClist = (Get-ADForest).Domains | % { Get-ADDomainController –Filter * -Server $_ } | Select Site, Name, Domain
And it generates the following output:
Site Name Domain
---- ---- ------
Site-A DC-123 acme.local
Site-A DC-ABC acme.local
Site-B DC-XYZ domain.local
Site-C DC-YPT domain.local
Now I would like to count the number of objects in the column 'Name' and display something like this:
Site Count_of_Name
---- ----
Site-A 2
Site-B 1
Site-C 1
I have already tried a lot of things and the closest I got so far was using:
$DcList | Group-Object Site
But unfortunately it is not the right way to go as it only counts the number of 'Site' and "ignores" the rest. Also tried this, but it did not work as I expect either:
$DcList | Group-Object Site, Name
Please help me figure out the logic of this.
********************** UPDATE **********************
I have finally been able to come to this, but I cannot figure out a way to count the objects from 'Site' column:
$DClist | Group-Object -Property Site | ForEach-Object -Process {
[PSCustomObject]#{
Site = $_.Name
DCs = ($_.Group.Site)
}
}
Please help me out. I feel I'm so close to a solution now. :)
you are REALLY close, and the answer is about what you would expect :)
when doing group you automatically get a count property. just use this.
$DClist = (Get-ADForest).Domains | % { Get-ADDomainController –Filter * -Server $_ } | Select Site, Name, Domain
$dclist|Group-Object site|ForEach-Object{
[PSCustomObject]#{
site = $_.name
DCs = $_.group
count = $_.count
}
}
edit:
you could also do this that could be even faster if propegating through many objects. when doing select you can add a custom query and a label for that query.
#{name='fieldname';expression={$_.reference.to.object}} or #{n='field';e={$_.expression}} if you want to shorten it.
$dclist|Group-Object site|ForEach-Object{
$_|select #{n='site';e={$_.name}},count,#{n='DCs';e={$_.group}}
}
I don't exactly understand what you really want, but if it is some kind of tree, this will show it:
ForEach($Site in ($dclist | Group-Object site))
{
$Site.Count.ToString() + " " + $Site.Name
ForEach($Server in $Site.Group)
{
" + " + $Server.Name
}
}
Output:
2 Site-A
+ DC-123
+ DC-ABC
1 Site-B
+ DC-XYZ
1 Site-C
+ DC-YPT

cucumber webdriverio datatable

FeatureFile
Feature: Shopper can add an item to their Grocery List
#kk
Scenario: Mutate multiple User Skills at the same time
Then If I click the row "Summary" then I should the following nested information`
| Tax | 11.50 |
| Gratuity | 4.50 |
| Total | 26.59 |
StepDefininition File
Then(/^If I click the row "([^"]*)" then I should the following nested information$/, function (rowName, data){
cconsole.log("rowName-----"+rowName)
console.log("data-----"+data)
data = dataTable.raw();
console.log(data);`
});
Error Log
If I click the row "Summary" then I should the following nested information
dataTable is not defined
ReferenceError: dataTable is not defined
at World.<anonymous> (/Users/src/__acceptance__/stepDefinition/android/wdio.apps.stepdefs.js:12:3)
at new Promise (<anonymous>)
at new F (/Users/wdio-cucumber-framework/node_modules/core-js/library/modules/_export.js:36:28)
Please help me to resolve this issue.....
I am not overly familiar with Webdriver-io, but it would appear that you are using a variable that is not defined. You are passing data into your function, but trying to use dataTable which is throwing the error.
Have you tried something like:
function(rowName, table) {
var myData = table.rowsHash();
console.log(myData);
console.log(table.raw());
}
Unrelated to your question, I would suggest separating your action steps from your validation steps
If I click the row "Summary"
Then I should see the following nested information
| Tax | 11.50 |
| Gratuity | 4.50 |
| Total | 26.59 |
You have a problem in your code on the stepDefinition file:
on the line data = dataTable.raw();... there is no variable dataTable defined.
Please try the below code:
Then(/^If I click the row "([^"]*)" then I should the following nested information$/, function (rowName, dataTable){
console.log(dataTable);
var data = dataTable.raw();
console.log(data);
data.forEach(function(element) {
console.log("Element:" + element[0]);
console.log("Element:" + element[1]);
}, this);
});

DOORS Compound Filter Dilemma

DOORS Version: 9.5.2.1
I'll try to break this down as simple as I can. First, I'll start with the data. Assume I have a module, Module, in DOORS. Module is comprised of:
Tree Structure
Assume that Object Text for headings and sub-headings are blank, and assume Object Text for the remaining Level 3 objects is the same as the name of the object itself. For example, Object Heading is blank for Object_1.1.0-1, but its Object Text is "Object_1.1.0-1".
- Module
- 1 Heading1 // Object Heading: "Heading1" ; Object Number: 1
| - 1.1 Sub-Heading1.1 // Object Heading: "Sub-Heading1.1" ; Object Number: 1.1
| | + Object_1.1.0-1 // Object Heading: "" ; Object Number: 1.1.0-1
| | + Object_1.1.0-2 // Object Heading: "" ; Object Number: 1.1.0-2
| | | .
| | | .
| | | .
| | + Object_1.1.0-A // Object Heading: "" ; Object Number: 1.1.0-A
| |
| - 1.2 Sub-Heading1.2 // Object Heading: "Sub-Heading1.2" ; Object Number: 1.2
| + Object_1.2.0-1 // Object Heading: "" ; Object Number: 1.2.0-1
| + Object_1.2.0-2 // Object Heading: "" ; Object Number: 1.2.0-2
| | .
| | .
| | .
| + Object_1.2.0-B // Object Heading: "" ; Object Number: 1.2.0-B
|
- 2 Heading2 // Object Heading: "Heading2" ; Object Number: 2
- 2.1 Sub-Heading2.1 // Object Heading: "Sub-Heading2.1" ; Object Number: 2.1
| + Object_2.1.0-1 // Object Heading: "" ; Object Number: 2.1.0-1
| + Object_2.1.0-2 // Object Heading: "" ; Object Number: 2.1.0-2
| | .
| | .
| | .
| + Object_2.1.0-C // Object Heading: "" ; Object Number: 2.1.0-C
|
- 2.2 Sub-Heading2.1 // Object Heading: "Sub-Heading2.1" ; Object Number 2.2
+ Object_2.2.0-1 // Object Heading: "" ; Object Number: 2.2.0-1
+ Object_2.2.0-2 // Object Heading: "" ; Object Number: 2.2.0-2
| .
| .
| .
+ Object_2.2.0-D // Object Heading: "" ; Object Number: 2.2.0-D
And so on and so forth . . .
Attributes
*Object Heading and Text*, Version, Data
Object Heading and Text seems to be a DOORS thing, so I won't explain that here. Data here is generic (and, in reality, represents more than one attribute). Some data is applicable to some versions while other data is applicable to other versions. The data for different versions may intersect while some data for other versions are mutually exclusive. Version is a single string that delimits the different versions by new lines, "\n". So, let's assume that Version is:
v1\nv2\nv3 . . . v\nvX
or, in a more readable format:
v1
v2
v3
.
.
.
vX
What's more, Version for one object may be (comma-separated here for readability) v1, v2, v3, . . ., vX while for another it might be v1, v3 and for another perhaps just v2. Any combination of available versions, really.
The Problem
What I'm attempting to do seems to me like it should be easy. A no-brainer. Just to pick an example, let's say I want to apply a filter whereby I view only Sub-Heading1.2 and its children, and that only for Version v3. I've tried many variations on the theme, but I can only seem to accomplish one or the other. Either I successfully isolate data for a single section or a single version, but I cannot get both. When I apply a filter for a single section, say Sub-Heading1.2 and its children, and then AND that with "includes v3"; I will get that section, but it refuses to show only that section only for v3.
In any programming language, a and b and c evaluates to true IF AND ONLY IF a and b and c. What I'm seeing in DOORS seems to me to be more like (a and b) or c.
With a DOORS database described as above, how can I view only the objects in a given range (or an object and its descendants) only for a given version? I know DXL exists as a potential solution, but a GUI solution is preferable.
Your issue is Include Descendants. This options specifically ignores the filter. What it is really saying is, "Show me everything that matches my filter, and all of their descendants".
Using your example above, what you want for a filter is:
Object Number >= 1.2
and
Object Number < 2 (or maybe 1.3 depending on how you want it)
and
Version includes v3
This will give you what you are looking for. Be sure NOT to Include Descendants as this will negate the second rule in the filter.
Good luck!

Preconfigured Magento Widgets

Is there a UI or programatic system for taking advantage of the "Preconfigured Widget" functionality that's part of Magento's CMS page rendering?
When adding a widget to a CMS page, the code that renders that widget is located in the template directive processing class. This code
File: app/code/core/Mage/Widget/Model/Template/Filter.php
class Mage_Adminhtml_Cms_PageController extends Mage_Adminhtml_Controller_Action
{
...
}
When loading a Widget's paramaters, there the following bit of code
// validate required parameter type or id
if (!empty($params['type'])) {
$type = $params['type'];
} elseif (!empty($params['id'])) {
$preconfigured = Mage::getResourceSingleton('widget/widget')
->loadPreconfiguredWidget($params['id']);
$type = $preconfigured['type'];
$params = $preconfigured['parameters'];
} else {
return '';
}
This code appears to parse a widget directive tag for an id value
{{widget name="foobazbar" id=""}}
and then load the configuration from a widget model
public function loadPreconfiguredWidget($widgetId)
{
$read = $this->_getReadAdapter();
$select = $read->select();
$select->from($this->getMainTable())
->where($this->getIdFieldName() . ' = ?', $widgetId);
var_dump((string)$select);
$widget = $read->fetchRow($select);
if (is_array($widget)) {
if ($widget['parameters']) {
$widget['parameters'] = unserialize($widget['parameters']);
}
return $widget;
}
return false;
}
When I first encountered this code, I assumed it was loading up a Widget Instance model. However, it's not. Instead it's loading data from a widget/widget class, which corresponds to the widget table.
mysql> describe widget;
+------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+------------------+------+-----+---------+----------------+
| widget_id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| code | varchar(255) | NO | MUL | NULL | |
| type | varchar(255) | NO | | NULL | |
| parameters | text | YES | | NULL | |
+------------+------------------+------+-----+---------+----------------+
Is there a UI or system for adding data to this table? Does anyone (who works fro Magento Inc. or not) know if this is a supported feature, or if it's the start of something that's been abandoned, but left in for backward compatibility reasons?
This answer is somewhat off-topic, but I'm not sure if it might satisfy your need anyway. I've discovered that you can create widget instances in the admin CMS>Widgets section, and then render them via the following code:
$oWidget = Mage::getModel('widget/widget_instance')->load('HomepageTwitter','title');
$oWidgetBlock = Mage::app()->getLayout()->createBlock($oWidget->getType(), $oWidget->getTitle(), $oWidget->getWidgetParameters());
echo $oWidgetBlock->toHtml();
Note that the block is loaded by title (rather than arbitrary ID), and that the widget parameters are passed for the Block to render.
Per several comments, and private emails, it appears this is a privatish feature for the Magento core team, and has nothing to do with Instance Widgets.

Resources