Skip to content

Commit

Permalink
TEIIDDES-1386 xml selection now allows multiple elements
Browse files Browse the repository at this point in the history
  • Loading branch information
blafond committed Jul 16, 2015
1 parent 3b5113a commit edd1029
Showing 1 changed file with 10 additions and 7 deletions.
Expand Up @@ -71,7 +71,7 @@ private void createPanel(Composite parent) {
gd.heightHint = 400;
fileContentsGroup.setLayoutData(gd);

this.xmlTreeViewer = new TreeViewer(fileContentsGroup, SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
this.xmlTreeViewer = new TreeViewer(fileContentsGroup, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
GridData data = new GridData(GridData.FILL_BOTH);
data.horizontalSpan=4;
this.xmlTreeViewer.getControl().setLayoutData(data);
Expand Down Expand Up @@ -120,7 +120,7 @@ public String getText( Object element ) {
public void selectionChanged( final SelectionChangedEvent event ) {
columnMenuManager.removeAll();
IStructuredSelection sel = (IStructuredSelection)xmlTreeViewer.getSelection();
if (sel.size() == 1) {
if (sel.size() > 0) {
columnMenuManager.add(createColumnAction);
columnMenuManager.add(setRootPathAction);
columnsInfoPanel.notifySelection(true);
Expand All @@ -136,7 +136,7 @@ public void selectionChanged( final SelectionChangedEvent event ) {
@Override
public void doubleClick(DoubleClickEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
if (selection != null && !selection.isEmpty() ) {
if (selection != null && !selection.isEmpty() && selection.size() == 1 ) {
createColumn();
}
}
Expand Down Expand Up @@ -169,11 +169,14 @@ private void setRootPath() {

public void createColumn() {
IStructuredSelection sel = (IStructuredSelection)xmlTreeViewer.getSelection();
Object obj = sel.getFirstElement();
if( obj instanceof XmlElement || obj instanceof XmlAttribute ) {
getFileInfo().addNewColumn(obj);
this.configPage.handleInfoChanged(false);
boolean changed = false;
for( Object obj : sel.toList() ) {
if( obj instanceof XmlElement || obj instanceof XmlAttribute ) {
getFileInfo().addNewColumn(obj);
changed = true;
}
}
if( changed ) this.configPage.handleInfoChanged(false);
}

Object[] getNodeChildren( Object element ) {
Expand Down

0 comments on commit edd1029

Please sign in to comment.