diff options
author | Bernd Hufmann | 2013-11-05 19:57:10 +0000 |
---|---|---|
committer | Bernd Hufmann | 2013-11-08 13:17:19 +0000 |
commit | 845db098079ba6b978100fa3e0e7df5988ec0bef (patch) | |
tree | f8b697809978dc83e29a19cb17119190889dac64 | |
parent | 5100930b6497189de343f031aa73dad2c4ee2947 (diff) | |
download | org.eclipse.linuxtools-845db098079ba6b978100fa3e0e7df5988ec0bef.tar.gz org.eclipse.linuxtools-845db098079ba6b978100fa3e0e7df5988ec0bef.tar.xz org.eclipse.linuxtools-845db098079ba6b978100fa3e0e7df5988ec0bef.zip |
lttng: Add possibility to select/deselect all in remote import dialog
Change-Id: I41c32e3d214b422795679ba1d2e425eb8af58e5b
Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/18099
Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
IP-Clean: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tested-by: Hudson CI
5 files changed, 55 insertions, 16 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki b/lttng/org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki index 02bf777eff..68d4ba90b5 100644 --- a/lttng/org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki +++ b/lttng/org.eclipse.linuxtools.lttng.help/doc/User-Guide.mediawiki @@ -1264,7 +1264,7 @@ A new display will open for selecting the traces to import. [[Image:images/LTTng2ImportDialog.png]] -By default all traces are selected. Also, a default project with the name '''Remote''' is selected which will be created if necessary. Update the list of traces to be imported, if necessary, by selecting and deselecting the relevant traces in the tree viewer. Also if needed, change the tracing project from the '''Available Projects''' combo box. Select the Overwrite button ('''Overwrite existing trace without warning''') if required. Then press button '''Ok'''. Upon successful import operation the selected traces will be stored in the '''Traces''' directory of the specified tracing project. For '''Kernel''' traces the trace type '''LTTng Kernel''' and for '''UST''' traces the trace type '''Generic CTF Trace''' will be set. From the '''Project Explorer''' view, the trace can be analyzed further. +By default all traces are selected. A default project with the name '''Remote''' is selected which will be created if necessary. Update the list of traces to be imported, if necessary, by selecting and deselecting the relevant traces in the tree viewer. Use buttons '''Select All''' or '''Deselect All''' to select or deselect all traces. Also if needed, change the tracing project from the '''Available Projects''' combo box. Select the Overwrite button ('''Overwrite existing trace without warning''') if required. Then press button '''Ok'''. Upon successful import operation the selected traces will be stored in the '''Traces''' directory of the specified tracing project. For '''Kernel''' traces the trace type '''LTTng Kernel''' and for '''UST''' traces the trace type '''Generic CTF Trace''' will be set. From the '''Project Explorer''' view, the trace can be analyzed further. '''Note''': The trace will be imported with a name constructed with information about session, whether it is a kernel or ust trace, ust buffer type (per UID or per PID) and snapshot details. diff --git a/lttng/org.eclipse.linuxtools.lttng.help/doc/images/LTTng2ImportDialog.png b/lttng/org.eclipse.linuxtools.lttng.help/doc/images/LTTng2ImportDialog.png Binary files differindex 9a44b8910e..09b3520ea6 100644 --- a/lttng/org.eclipse.linuxtools.lttng.help/doc/images/LTTng2ImportDialog.png +++ b/lttng/org.eclipse.linuxtools.lttng.help/doc/images/LTTng2ImportDialog.png diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ImportDialog.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ImportDialog.java index d49f8b2aee..b82653d800 100644 --- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ImportDialog.java +++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ImportDialog.java @@ -38,6 +38,8 @@ import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSys import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CCombo; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -119,6 +121,10 @@ public class ImportDialog extends Dialog implements IImportDialog { * Flag to indicate that something went wrong when creating the dialog box. */ private boolean fIsError = false; + /** + * Children of the remote folder (can be null) + */ + private Object[] fFolderChildren = null; // ------------------------------------------------------------------------ // Constructors @@ -189,8 +195,24 @@ public class ImportDialog extends Dialog implements IImportDialog { @Override protected void createButtonsForButtonBar(Composite parent) { - createButton(parent, IDialogConstants.CANCEL_ID, "&Cancel", true); //$NON-NLS-1$ - createButton(parent, IDialogConstants.OK_ID, "&Ok", true); //$NON-NLS-1$ + Button selectAllButton = createButton(parent, IDialogConstants.SELECT_ALL_ID, Messages.TraceControl_ImportDialog_SelectAll, true); + selectAllButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + setFolderChildrenChecked(true); + } + }); + + Button deselectAllButton = createButton(parent, IDialogConstants.DESELECT_ALL_ID, Messages.TraceControl_ImportDialog_DeselectAll, true); + deselectAllButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + setFolderChildrenChecked(false); + } + }); + createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true); + createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); + updateOKButtonEnablement(); } @Override @@ -345,7 +367,7 @@ public class ImportDialog extends Dialog implements IImportDialog { // make sure that remote directory is read and not cached remoteFolder.markStale(true, true); - fFolderViewer = new CheckboxTreeViewer(contextGroup, SWT.BORDER); + fFolderViewer = new CheckboxTreeViewer(contextGroup, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); GridData data = new GridData(GridData.FILL_BOTH); Tree tree = fFolderViewer.getTree(); tree.setLayoutData(data); @@ -365,26 +387,22 @@ public class ImportDialog extends Dialog implements IImportDialog { // A trick to keep selection of a file in sync with the directory boolean p = fFolderViewer.getChecked((element.getParentRemoteFile())); fFolderViewer.setChecked(element, p); - return; - } - fFolderViewer.setSubtreeChecked(event.getElement(), event.getChecked()); - if (!event.getChecked()) { - fFolderViewer.setChecked(element.getParentRemoteFile(), false); + } else { + fFolderViewer.setSubtreeChecked(event.getElement(), event.getChecked()); + if (!event.getChecked()) { + fFolderViewer.setChecked(element.getParentRemoteFile(), false); + } } + updateOKButtonEnablement(); } } }); fFolderViewer.setInput(remoteFolder); - Object[] children = remoteFolder.getContents(RemoteChildrenContentsType.getInstance()); + fFolderChildren = remoteFolder.getContents(RemoteChildrenContentsType.getInstance()); // children can be null if there the path doesn't exist. This happens when a trace // session hadn't been started and no output was created. - if (children != null) { - // Select all traces by default - for (int i = 0; i < children.length; i++) { - fFolderViewer.setSubtreeChecked(children[i], true); - } - } + setFolderChildrenChecked(true); Group projectGroup = new Group(fDialogComposite, SWT.SHADOW_NONE); projectGroup.setText(Messages.TraceControl_ImportDialogProjectsGroupName); @@ -420,4 +438,20 @@ public class ImportDialog extends Dialog implements IImportDialog { getShell().setMinimumSize(new Point(500, 400)); } + private void setFolderChildrenChecked(boolean isChecked) { + if (fFolderChildren != null) { + for (Object child : fFolderChildren) { + fFolderViewer.setSubtreeChecked(child, isChecked); + } + } + updateOKButtonEnablement(); + } + + private void updateOKButtonEnablement() { + Object[] checked = fFolderViewer.getCheckedElements(); + Button okButton = getButton(IDialogConstants.OK_ID); + if (okButton != null) { + okButton.setEnabled(checked.length > 0); + } + } } diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java index 1b81e6d99a..3d291edafd 100644 --- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java +++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java @@ -216,6 +216,8 @@ final public class Messages extends NLS { public static String TraceControl_ImportDialogNoProjectSelectedError; public static String TraceControl_ImportDialogInvalidTracingProject; public static String TraceControl_ImportDialogNoTraceSelectedError; + public static String TraceControl_ImportDialog_SelectAll; + public static String TraceControl_ImportDialog_DeselectAll; public static String TraceControl_ImportDialogConfirmationTitle; public static String TraceControl_ImportDialogConfirmationOverwriteLabel; diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties index 8641cf582c..515c57c1e8 100644 --- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties +++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties @@ -211,6 +211,9 @@ TraceControl_ImportDialogConfirmationRenameLabel=Rename TraceControl_ImportDialogConfirmationNewNameLabel=New Trace Name TraceControl_InvalidTraceNameError=Invalid trace name TraceControl_ImportDialogTraceAlreadyExistError=Trace already exists in project +TraceControl_ImportDialog_SelectAll=Select All +TraceControl_ImportDialog_DeselectAll=Deselect All + # Tree structure strings TraceControl_KernelDomainDisplayName=Kernel |