1 /*******************************************************************************
2 * Copyright (c) 2009, 2016 Ericsson and others.
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Francois Chouinard - Initial API and implementation
11 * Francois Chouinard - Got rid of dependency on internal platform class
12 * Francois Chouinard - Complete re-design
13 * Anna Dushistova(Montavista) - [383047] NPE while importing a CFT trace
14 * Matthew Khouzam - Moved out some common functions
15 * Patrick Tasse - Add sorting of file system elements
16 * Bernd Hufmann - Re-design of trace selection and trace validation
17 * Marc-Andre Laperle - Preserve folder structure on import
18 * Marc-Andre Laperle - Extract archives during import
19 * Marc-Andre Laperle - Add support for Gzip (non-Tar)
20 *******************************************************************************/
22 package org
.eclipse
.tracecompass
.internal
.tmf
.ui
.project
.wizards
.importtrace
;
25 import java
.lang
.reflect
.InvocationTargetException
;
26 import java
.util
.ArrayList
;
27 import java
.util
.Collection
;
28 import java
.util
.LinkedList
;
29 import java
.util
.List
;
31 import org
.eclipse
.core
.resources
.IContainer
;
32 import org
.eclipse
.core
.resources
.IFolder
;
33 import org
.eclipse
.core
.resources
.IProject
;
34 import org
.eclipse
.core
.resources
.IResource
;
35 import org
.eclipse
.core
.resources
.IWorkspace
;
36 import org
.eclipse
.core
.resources
.ResourcesPlugin
;
37 import org
.eclipse
.core
.runtime
.CoreException
;
38 import org
.eclipse
.core
.runtime
.IPath
;
39 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
40 import org
.eclipse
.core
.runtime
.IStatus
;
41 import org
.eclipse
.core
.runtime
.NullProgressMonitor
;
42 import org
.eclipse
.core
.runtime
.Path
;
43 import org
.eclipse
.core
.runtime
.Platform
;
44 import org
.eclipse
.core
.runtime
.Status
;
45 import org
.eclipse
.core
.runtime
.SubMonitor
;
46 import org
.eclipse
.jface
.dialogs
.IDialogSettings
;
47 import org
.eclipse
.jface
.layout
.PixelConverter
;
48 import org
.eclipse
.jface
.operation
.IRunnableWithProgress
;
49 import org
.eclipse
.jface
.viewers
.CheckStateChangedEvent
;
50 import org
.eclipse
.jface
.viewers
.ICheckStateListener
;
51 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
52 import org
.eclipse
.jface
.viewers
.ITreeContentProvider
;
53 import org
.eclipse
.osgi
.util
.NLS
;
54 import org
.eclipse
.swt
.SWT
;
55 import org
.eclipse
.swt
.custom
.BusyIndicator
;
56 import org
.eclipse
.swt
.events
.FocusAdapter
;
57 import org
.eclipse
.swt
.events
.FocusEvent
;
58 import org
.eclipse
.swt
.events
.ModifyEvent
;
59 import org
.eclipse
.swt
.events
.ModifyListener
;
60 import org
.eclipse
.swt
.events
.SelectionAdapter
;
61 import org
.eclipse
.swt
.events
.SelectionEvent
;
62 import org
.eclipse
.swt
.events
.TraverseEvent
;
63 import org
.eclipse
.swt
.events
.TraverseListener
;
64 import org
.eclipse
.swt
.layout
.GridData
;
65 import org
.eclipse
.swt
.layout
.GridLayout
;
66 import org
.eclipse
.swt
.widgets
.Button
;
67 import org
.eclipse
.swt
.widgets
.Combo
;
68 import org
.eclipse
.swt
.widgets
.Composite
;
69 import org
.eclipse
.swt
.widgets
.DirectoryDialog
;
70 import org
.eclipse
.swt
.widgets
.Event
;
71 import org
.eclipse
.swt
.widgets
.FileDialog
;
72 import org
.eclipse
.swt
.widgets
.Group
;
73 import org
.eclipse
.swt
.widgets
.Label
;
74 import org
.eclipse
.swt
.widgets
.Text
;
75 import org
.eclipse
.tracecompass
.internal
.tmf
.ui
.Activator
;
76 import org
.eclipse
.tracecompass
.internal
.tmf
.ui
.project
.operations
.NewExperimentOperation
;
77 import org
.eclipse
.tracecompass
.internal
.tmf
.ui
.project
.operations
.SelectTracesOperation
;
78 import org
.eclipse
.tracecompass
.tmf
.core
.TmfCommonConstants
;
79 import org
.eclipse
.tracecompass
.tmf
.core
.TmfProjectNature
;
80 import org
.eclipse
.tracecompass
.tmf
.core
.project
.model
.TmfTraceType
;
81 import org
.eclipse
.tracecompass
.tmf
.core
.util
.Pair
;
82 import org
.eclipse
.tracecompass
.tmf
.ui
.project
.model
.TmfExperimentElement
;
83 import org
.eclipse
.tracecompass
.tmf
.ui
.project
.model
.TmfExperimentFolder
;
84 import org
.eclipse
.tracecompass
.tmf
.ui
.project
.model
.TmfProjectElement
;
85 import org
.eclipse
.tracecompass
.tmf
.ui
.project
.model
.TmfProjectRegistry
;
86 import org
.eclipse
.tracecompass
.tmf
.ui
.project
.model
.TmfTraceFolder
;
87 import org
.eclipse
.tracecompass
.tmf
.ui
.project
.model
.TmfTracesFolder
;
88 import org
.eclipse
.ui
.dialogs
.FileSystemElement
;
89 import org
.eclipse
.ui
.dialogs
.WizardResourceImportPage
;
90 import org
.eclipse
.ui
.ide
.dialogs
.IElementFilter
;
91 import org
.eclipse
.ui
.ide
.dialogs
.ResourceTreeAndListGroup
;
92 import org
.eclipse
.ui
.internal
.ide
.DialogUtil
;
93 import org
.eclipse
.ui
.model
.WorkbenchContentProvider
;
94 import org
.eclipse
.ui
.model
.WorkbenchLabelProvider
;
95 import org
.eclipse
.ui
.model
.WorkbenchViewerComparator
;
98 * A variant of the standard resource import wizard for importing traces to
99 * given tracing project. If no project or tracing project was selected the
100 * wizard imports it to the default tracing project which is created if
103 * In our case traces could be files or a directory structure. This wizard
104 * supports both cases. It imports traces for a selected trace type or, if no
105 * trace type is selected, it tries to detect the trace type automatically.
106 * However, the automatic detection is a best-effort and cannot guarantee that
107 * the detection is successful. The reason for this is that there might be
108 * multiple trace types that can be assigned to a single trace.
111 * @author Francois Chouinard
113 @SuppressWarnings("restriction")
114 public class ImportTraceWizardPage
extends WizardResourceImportPage
{
116 // ------------------------------------------------------------------------
118 // ------------------------------------------------------------------------
119 private static final String IMPORT_WIZARD_PAGE_NAME
= "ImportTraceWizardPage"; //$NON-NLS-1$
120 private static final String IMPORT_WIZARD_ROOT_DIRECTORY_ID
= ".import_root_directory_id"; //$NON-NLS-1$ ;
121 private static final String IMPORT_WIZARD_ARCHIVE_FILE_NAME_ID
= ".import_archive_file_name_id"; //$NON-NLS-1$
122 private static final String IMPORT_WIZARD_IMPORT_UNRECOGNIZED_ID
= ".import_unrecognized_traces_id"; //$NON-NLS-1$
123 private static final String IMPORT_WIZARD_PRESERVE_FOLDERS_ID
= ".import_preserve_folders_id"; //$NON-NLS-1$
124 private static final String IMPORT_WIZARD_IMPORT_FROM_DIRECTORY_ID
= ".import_from_directory"; //$NON-NLS-1$
125 private static final String IMPORT_WIZARD_CREATE_EXPERIMENT_ID
= ".create_experiment"; //$NON-NLS-1$
127 // constant from WizardArchiveFileResourceImportPage1
128 private static final String
[] FILE_IMPORT_MASK
= { "*.jar;*.zip;*.tar;*.tar.gz;*.tgz;*.gz", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$
131 * A special trace type value to communicate that automatic trace type
132 * detection will occur instead of setting a specific trace type when
133 * importing the traces.
135 public static final String TRACE_TYPE_AUTO_DETECT
= Messages
.ImportTraceWizard_AutoDetection
;
138 * Preserve the folder structure of the import traces.
140 public static final int OPTION_PRESERVE_FOLDER_STRUCTURE
= 1 << 1;
142 * Create links to the trace files instead of copies.
144 public static final int OPTION_CREATE_LINKS_IN_WORKSPACE
= 1 << 2;
146 * Import files that were not recognized as the selected trace type.
148 public static final int OPTION_IMPORT_UNRECOGNIZED_TRACES
= 1 << 3;
150 * Overwrite existing resources without prompting.
152 public static final int OPTION_OVERWRITE_EXISTING_RESOURCES
= 1 << 4;
154 * Create an experiment with imported traces.
156 public static final int OPTION_CREATE_EXPERIMENT
= 1 << 5;
158 // ------------------------------------------------------------------------
160 // ------------------------------------------------------------------------
162 // Target import directory ('Traces' folder)
163 private IFolder fTargetFolder
;
164 // Target Trace folder element
165 private TmfTraceFolder fTraceFolderElement
;
166 // The workspace experiment folder
167 private TmfExperimentFolder fExperimentFolderElement
;
168 private String fPreviousSource
;
169 // Flag to handle destination folder change event
170 private Boolean fIsDestinationChanged
= false;
171 private final Object fSyncObject
= new Object();
172 // Combo box containing trace types
173 private Combo fTraceTypes
;
174 // Button to ignore unrecognized traces or not
175 private Button fImportUnrecognizedButton
;
176 // Button to overwrite existing resources or not
177 private Button fOverwriteExistingResourcesCheckbox
;
178 // Button to link or copy traces to workspace
179 private Button fCreateLinksInWorkspaceButton
;
180 // Button to preserve folder structure
181 private Button fPreserveFolderStructureButton
;
182 // Button to create an experiment
183 private Button fCreateExperimentCheckbox
;
184 // Text box for experiment name
185 private Text fExperimentNameText
;
186 private boolean entryChanged
= false;
187 // The import from directory radio button
188 private Button fImportFromDirectoryRadio
;
189 // The import from archive radio button
190 private Button fImportFromArchiveRadio
;
191 // Flag to remember the "create links" checkbox when it gets disabled by
192 // the import from archive radio button
193 private Boolean fPreviousCreateLinksValue
= true;
195 /** The archive name field */
196 protected Combo fArchiveNameField
;
197 /** The archive browse button. */
198 protected Button fArchiveBrowseButton
;
199 /** The directory name field */
200 protected Combo directoryNameField
;
201 /** The directory browse button. */
202 protected Button directoryBrowseButton
;
204 private ResourceTreeAndListGroup fSelectionGroup
;
206 // Keep trace of the selection root so that we can dispose its related
208 private TraceFileSystemElement fSelectionGroupRoot
;
210 // ------------------------------------------------------------------------
212 // ------------------------------------------------------------------------
215 * Constructor. Creates the trace wizard page.
218 * The name of the page.
220 * The current selection
222 protected ImportTraceWizardPage(String name
, IStructuredSelection selection
) {
223 super(name
, selection
);
224 setTitle(Messages
.ImportTraceWizard_FileSystemTitle
);
225 setDescription(Messages
.ImportTraceWizard_ImportTrace
);
227 // Locate the target trace folder
228 IFolder traceFolder
= null;
229 Object element
= selection
.getFirstElement();
231 if (element
instanceof TmfTraceFolder
) {
232 fTraceFolderElement
= (TmfTraceFolder
) element
;
233 traceFolder
= fTraceFolderElement
.getResource();
234 } else if (element
instanceof IProject
) {
235 IProject project
= (IProject
) element
;
237 if (project
.hasNature(TmfProjectNature
.ID
)) {
238 TmfProjectElement projectElement
= TmfProjectRegistry
.getProject(project
, true);
239 fTraceFolderElement
= projectElement
.getTracesFolder();
240 traceFolder
= project
.getFolder(TmfTracesFolder
.TRACES_FOLDER_NAME
);
242 } catch (CoreException e
) {
246 // If no tracing project was selected or trace folder doesn't exist use
247 // default tracing project
248 if (traceFolder
== null) {
249 IProject project
= TmfProjectRegistry
.createProject(
250 TmfCommonConstants
.DEFAULT_TRACE_PROJECT_NAME
, null, new NullProgressMonitor());
251 TmfProjectElement projectElement
= TmfProjectRegistry
.getProject(project
, true);
252 fTraceFolderElement
= projectElement
.getTracesFolder();
253 traceFolder
= project
.getFolder(TmfTracesFolder
.TRACES_FOLDER_NAME
);
256 // Set the target trace folder
257 if (traceFolder
!= null) {
258 fTargetFolder
= traceFolder
;
259 String path
= traceFolder
.getFullPath().toString();
260 setContainerFieldValue(path
);
263 TmfProjectElement project
= fTraceFolderElement
.getProject();
264 fExperimentFolderElement
= project
.getExperimentsFolder();
271 * The current selection
273 public ImportTraceWizardPage(IStructuredSelection selection
) {
274 this(IMPORT_WIZARD_PAGE_NAME
, selection
);
278 * Create the import source selection widget. (Copied from
279 * WizardResourceImportPage but instead always uses the internal
280 * ResourceTreeAndListGroup to keep compatibility with Kepler)
283 protected void createFileSelectionGroup(Composite parent
) {
285 // Just create with a dummy root.
286 fSelectionGroup
= new ResourceTreeAndListGroup(parent
,
287 new FileSystemElement("Dummy", null, true), //$NON-NLS-1$
288 getFolderProvider(), new WorkbenchLabelProvider(),
289 getFileProvider(), new WorkbenchLabelProvider(), SWT
.NONE
,
290 DialogUtil
.inRegularFontMode(parent
));
292 ICheckStateListener listener
= new ICheckStateListener() {
294 public void checkStateChanged(CheckStateChangedEvent event
) {
295 updateWidgetEnablements();
299 WorkbenchViewerComparator comparator
= new WorkbenchViewerComparator();
300 fSelectionGroup
.setTreeComparator(comparator
);
301 fSelectionGroup
.setListComparator(comparator
);
302 fSelectionGroup
.addCheckStateListener(listener
);
306 // ------------------------------------------------------------------------
307 // WizardResourceImportPage
308 // ------------------------------------------------------------------------
311 protected void createSourceGroup(Composite parent
) {
312 createSourceSelectionGroup(parent
);
313 createFileSelectionGroup(parent
);
314 createTraceTypeGroup(parent
);
315 validateSourceGroup();
319 protected ITreeContentProvider
getFileProvider() {
320 return new WorkbenchContentProvider() {
322 public Object
[] getChildren(Object object
) {
323 if (object
instanceof TraceFileSystemElement
) {
324 TraceFileSystemElement element
= (TraceFileSystemElement
) object
;
325 return element
.getFiles().getChildren(element
);
327 return new Object
[0];
333 protected ITreeContentProvider
getFolderProvider() {
334 return new WorkbenchContentProvider() {
336 public Object
[] getChildren(Object o
) {
337 if (o
instanceof TraceFileSystemElement
) {
338 TraceFileSystemElement element
= (TraceFileSystemElement
) o
;
339 return element
.getFolders().getChildren();
341 return new Object
[0];
345 public boolean hasChildren(Object o
) {
346 if (o
instanceof TraceFileSystemElement
) {
347 TraceFileSystemElement element
= (TraceFileSystemElement
) o
;
348 if (element
.isPopulated()) {
349 return getChildren(element
).length
> 0;
351 // If we have not populated then wait until asked
359 // ------------------------------------------------------------------------
360 // Directory Selection Group (forked WizardFileSystemResourceImportPage1)
361 // ------------------------------------------------------------------------
364 * creates the source selection group.
367 * the parent composite
369 protected void createSourceSelectionGroup(Composite parent
) {
371 Composite sourceGroup
= new Composite(parent
, SWT
.NONE
);
372 GridLayout layout
= new GridLayout();
373 layout
.numColumns
= 3;
374 layout
.makeColumnsEqualWidth
= false;
375 layout
.marginWidth
= 0;
376 sourceGroup
.setLayout(layout
);
377 sourceGroup
.setLayoutData(new GridData(GridData
.FILL_HORIZONTAL
));
379 // import from directory radio button
380 fImportFromDirectoryRadio
= new Button(sourceGroup
, SWT
.RADIO
);
381 fImportFromDirectoryRadio
.setText(Messages
.ImportTraceWizard_DirectoryLocation
);
383 // import location entry combo
384 directoryNameField
= createPathSelectionCombo(sourceGroup
);
385 createDirectoryBrowseButton(sourceGroup
);
387 // import from archive radio button
388 fImportFromArchiveRadio
= new Button(sourceGroup
, SWT
.RADIO
);
389 fImportFromArchiveRadio
.setText(Messages
.ImportTraceWizard_ArchiveLocation
);
391 // import location entry combo
392 fArchiveNameField
= createPathSelectionCombo(sourceGroup
);
393 createArchiveBrowseButton(sourceGroup
);
395 fImportFromDirectoryRadio
.setSelection(true);
396 fArchiveNameField
.setEnabled(false);
397 fArchiveBrowseButton
.setEnabled(false);
399 fImportFromDirectoryRadio
.addSelectionListener(new SelectionAdapter() {
401 public void widgetSelected(SelectionEvent e
) {
402 directoryRadioSelected();
406 fImportFromArchiveRadio
.addSelectionListener(new SelectionAdapter() {
408 public void widgetSelected(SelectionEvent e
) {
409 archiveRadioSelected();
415 * Select or deselect all files in the file selection group
418 * whether or not the files should be checked
420 protected void setFileSelectionGroupChecked(boolean checked
) {
421 if (fSelectionGroup
!= null) {
422 fSelectionGroup
.setAllSelections(checked
);
427 * Create a combo that will be used to select a path to specify the source
428 * of the import. The parent is assumed to have a GridLayout.
431 * the parent composite
432 * @return the created path selection combo
434 protected Combo
createPathSelectionCombo(Composite parent
) {
435 Combo pathSelectionCombo
= new Combo(parent
, SWT
.BORDER
);
437 GridData layoutData
= new GridData(GridData
.HORIZONTAL_ALIGN_FILL
| GridData
.GRAB_HORIZONTAL
);
438 layoutData
.widthHint
= new PixelConverter(pathSelectionCombo
).convertWidthInCharsToPixels(25);
439 pathSelectionCombo
.setLayoutData(layoutData
);
441 TraverseListener traverseListener
= new TraverseListener() {
443 public void keyTraversed(TraverseEvent e
) {
444 if (e
.detail
== SWT
.TRAVERSE_RETURN
) {
446 entryChanged
= false;
447 updateFromSourceField();
452 FocusAdapter focusAdapter
= new FocusAdapter() {
454 public void focusLost(FocusEvent e
) {
455 // Clear the flag to prevent constant update
457 entryChanged
= false;
458 updateFromSourceField();
463 SelectionAdapter selectionAdapter
= new SelectionAdapter() {
465 public void widgetSelected(SelectionEvent e
) {
466 entryChanged
= false;
467 updateFromSourceField();
471 ModifyListener modifyListner
= new ModifyListener() {
473 public void modifyText(ModifyEvent e
) {
478 pathSelectionCombo
.addModifyListener(modifyListner
);
479 pathSelectionCombo
.addTraverseListener(traverseListener
);
480 pathSelectionCombo
.addFocusListener(focusAdapter
);
481 pathSelectionCombo
.addSelectionListener(selectionAdapter
);
483 return pathSelectionCombo
;
487 * Create the directory browse button.
490 * the parent composite
492 protected void createDirectoryBrowseButton(Composite parent
) {
493 directoryBrowseButton
= createPathSelectionBrowseButton(parent
);
494 directoryBrowseButton
.addSelectionListener(new SelectionAdapter() {
496 public void widgetSelected(SelectionEvent e
) {
497 handleSourceDirectoryBrowseButtonPressed();
503 * Create the archive browse button.
506 * the parent composite
508 protected void createArchiveBrowseButton(Composite parent
) {
509 fArchiveBrowseButton
= createPathSelectionBrowseButton(parent
);
510 fArchiveBrowseButton
.addSelectionListener(new SelectionAdapter() {
512 public void widgetSelected(SelectionEvent e
) {
513 handleArchiveBrowseButtonPressed(FILE_IMPORT_MASK
);
519 * Create a browse button that will be used to browse for a path to specify
520 * the source of the import. The parent is assumed to have a GridLayout.
523 * the parent composite
524 * @return the created path selection combo
526 protected Button
createPathSelectionBrowseButton(Composite parent
) {
527 Button pathSelectionBrowseButton
= new Button(parent
, SWT
.PUSH
);
528 pathSelectionBrowseButton
.setText(Messages
.ImportTraceWizard_BrowseButton
);
529 setButtonLayoutData(pathSelectionBrowseButton
);
531 return pathSelectionBrowseButton
;
534 private void archiveRadioSelected() {
535 if (!isImportFromDirectory()) {
536 directoryNameField
.setEnabled(false);
537 directoryBrowseButton
.setEnabled(false);
538 fArchiveNameField
.setEnabled(true);
539 fArchiveBrowseButton
.setEnabled(true);
540 updateFromSourceField();
541 fArchiveNameField
.setFocus();
542 if (fCreateLinksInWorkspaceButton
!= null) {
543 fPreviousCreateLinksValue
= fCreateLinksInWorkspaceButton
.getSelection();
544 fCreateLinksInWorkspaceButton
.setSelection(false);
545 fCreateLinksInWorkspaceButton
.setEnabled(false);
550 private void directoryRadioSelected() {
551 if (isImportFromDirectory()) {
552 directoryNameField
.setEnabled(true);
553 directoryBrowseButton
.setEnabled(true);
554 fArchiveNameField
.setEnabled(false);
555 fArchiveBrowseButton
.setEnabled(false);
556 updateFromSourceField();
557 directoryNameField
.setFocus();
558 if (fCreateLinksInWorkspaceButton
!= null) {
559 fCreateLinksInWorkspaceButton
.setSelection(fPreviousCreateLinksValue
);
560 fCreateLinksInWorkspaceButton
.setEnabled(true);
565 // ------------------------------------------------------------------------
566 // Browse for the source directory
567 // ------------------------------------------------------------------------
570 public void handleEvent(Event event
) {
571 if (event
.widget
== directoryBrowseButton
) {
572 handleSourceDirectoryBrowseButtonPressed();
575 // Avoid overwriting destination path without repeatedly trigger
576 // call of handleEvent();
577 synchronized (fSyncObject
) {
578 if (fIsDestinationChanged
== false) {
579 event
.display
.asyncExec(new Runnable() {
582 synchronized (fSyncObject
) {
583 fIsDestinationChanged
= true;
584 String path
= fTargetFolder
.getFullPath().toString();
585 setContainerFieldValue(path
);
590 fIsDestinationChanged
= false;
593 super.handleEvent(event
);
597 protected void handleContainerBrowseButtonPressed() {
598 // Do nothing so that destination directory cannot be changed.
602 * Handle the button pressed event
604 protected void handleSourceDirectoryBrowseButtonPressed() {
605 String currentSource
= directoryNameField
.getText();
606 DirectoryDialog dialog
= new DirectoryDialog(directoryNameField
.getShell(), SWT
.SAVE
| SWT
.SHEET
);
607 dialog
.setText(Messages
.ImportTraceWizard_SelectTraceDirectoryTitle
);
608 dialog
.setMessage(Messages
.ImportTraceWizard_SelectTraceDirectoryMessage
);
609 dialog
.setFilterPath(getSourceDirectoryName(currentSource
));
611 String selectedDirectory
= dialog
.open();
612 if (selectedDirectory
!= null) {
613 // Just quit if the directory is not valid
614 if ((getSourceDirectory(selectedDirectory
) == null) || selectedDirectory
.equals(currentSource
)) {
617 // If it is valid then proceed to populate
618 setErrorMessage(null);
619 setSourcePath(selectedDirectory
);
624 * Handle the button pressed event
627 * file extensions used to filter files shown to the user
629 protected void handleArchiveBrowseButtonPressed(String
[] extensions
) {
630 FileDialog dialog
= new FileDialog(fArchiveNameField
.getShell(), SWT
.SHEET
);
631 dialog
.setFilterExtensions(extensions
);
632 dialog
.setText(Messages
.ImportTraceWizard_SelectTraceArchiveTitle
);
633 String fileName
= fArchiveNameField
.getText().trim();
634 if (!fileName
.isEmpty()) {
635 File path
= new File(fileName
).getParentFile();
636 if (path
!= null && path
.exists()) {
637 dialog
.setFilterPath(path
.toString());
641 String selectedArchive
= dialog
.open();
642 if (selectedArchive
!= null) {
643 setErrorMessage(null);
644 setSourcePath(selectedArchive
);
645 updateWidgetEnablements();
649 private File
getSourceDirectory() {
650 if (directoryNameField
== null) {
653 return getSourceDirectory(directoryNameField
.getText());
656 private File
getSourceArchiveFile() {
657 if (fArchiveNameField
== null) {
661 return getSourceArchiveFile(fArchiveNameField
.getText());
664 private String
getSourceContainerPath() {
665 if (isImportFromDirectory()) {
666 File sourceDirectory
= getSourceDirectory();
667 if (sourceDirectory
!= null) {
668 return sourceDirectory
.getAbsolutePath();
671 File sourceArchiveFile
= getSourceArchiveFile();
672 if (sourceArchiveFile
!= null) {
673 return sourceArchiveFile
.getParent();
678 private static File
getSourceDirectory(String path
) {
679 File sourceDirectory
= new File(getSourceDirectoryName(path
));
680 if (!sourceDirectory
.exists() || !sourceDirectory
.isDirectory()) {
684 return sourceDirectory
;
687 private static File
getSourceArchiveFile(String path
) {
688 File sourceArchiveFile
= new File(path
);
689 if (!sourceArchiveFile
.exists() || sourceArchiveFile
.isDirectory()) {
693 return sourceArchiveFile
;
696 private static String
getSourceDirectoryName(String sourceName
) {
697 IPath result
= new Path(sourceName
.trim());
698 if (result
.getDevice() != null && result
.segmentCount() == 0) {
699 result
= result
.addTrailingSeparator();
701 result
= result
.removeTrailingSeparator();
703 return result
.toOSString();
706 private void updateFromSourceField() {
707 setSourcePath(getSourceField().getText());
708 updateWidgetEnablements();
711 private Combo
getSourceField() {
712 if (directoryNameField
== null) {
713 return fArchiveNameField
;
716 return directoryNameField
.isEnabled() ? directoryNameField
: fArchiveNameField
;
720 * Set the source path that was selected by the user by various input
721 * methods (Browse button, typing, etc).
723 * Clients can also call this to set the path programmatically (hard-coded
724 * initial path) and this can also be overridden to be notified when the
725 * source path changes.
730 protected void setSourcePath(String path
) {
731 Combo sourceField
= getSourceField();
732 if (sourceField
== null) {
736 if (path
.length() > 0) {
737 String
[] currentItems
= sourceField
.getItems();
738 int selectionIndex
= -1;
739 for (int i
= 0; i
< currentItems
.length
; i
++) {
740 if (currentItems
[i
].equals(path
)) {
744 if (selectionIndex
< 0) {
745 int oldLength
= currentItems
.length
;
746 String
[] newItems
= new String
[oldLength
+ 1];
747 System
.arraycopy(currentItems
, 0, newItems
, 0, oldLength
);
748 newItems
[oldLength
] = path
;
749 sourceField
.setItems(newItems
);
750 selectionIndex
= oldLength
;
752 sourceField
.select(selectionIndex
);
757 // ------------------------------------------------------------------------
758 // File Selection Group (forked WizardFileSystemResourceImportPage1)
759 // ------------------------------------------------------------------------
760 private void resetSelection() {
762 if (fSelectionGroupRoot
!= null) {
763 disposeSelectionGroupRoot();
765 fSelectionGroupRoot
= getFileSystemTree();
766 fSelectionGroup
.setRoot(fSelectionGroupRoot
);
768 if (fCreateExperimentCheckbox
!= null) {
769 File file
= getSourceFile();
771 String previousName
= fExperimentNameText
.getText().trim();
772 if (((fPreviousSource
!= null) && (previousName
.equals(fPreviousSource
))) || previousName
.isEmpty()) {
773 fExperimentNameText
.setText(file
.getName());
775 fPreviousSource
= file
.getName();
780 private void disposeSelectionGroupRoot() {
781 if (fSelectionGroupRoot
!= null && fSelectionGroupRoot
.getProvider() != null) {
782 FileSystemObjectImportStructureProvider provider
= fSelectionGroupRoot
.getProvider();
784 fSelectionGroupRoot
= null;
788 private TraceFileSystemElement
getFileSystemTree() {
789 Pair
<IFileSystemObject
, FileSystemObjectImportStructureProvider
> rootObjectAndProvider
= ArchiveUtil
.getRootObjectAndProvider(getSourceFile(), getContainer().getShell());
790 if (rootObjectAndProvider
== null) {
793 return selectFiles(rootObjectAndProvider
.getFirst(), rootObjectAndProvider
.getSecond());
796 private TraceFileSystemElement
selectFiles(final IFileSystemObject rootFileSystemObject
,
797 final FileSystemObjectImportStructureProvider structureProvider
) {
798 final TraceFileSystemElement
[] results
= new TraceFileSystemElement
[1];
799 BusyIndicator
.showWhile(getShell().getDisplay(), new Runnable() {
802 // Create the root element from the supplied file system object
803 results
[0] = TraceFileSystemElement
.createRootTraceFileElement(rootFileSystemObject
, structureProvider
);
809 // ------------------------------------------------------------------------
811 // ------------------------------------------------------------------------
812 private final void createTraceTypeGroup(Composite parent
) {
813 Composite composite
= new Composite(parent
, SWT
.NONE
);
814 GridLayout layout
= new GridLayout();
815 layout
.numColumns
= 3;
816 layout
.makeColumnsEqualWidth
= false;
817 composite
.setLayout(layout
);
818 composite
.setFont(parent
.getFont());
819 GridData buttonData
= new GridData(SWT
.FILL
, SWT
.FILL
, true, false);
820 composite
.setLayoutData(buttonData
);
822 // Trace type label ("Trace Type:")
823 Label typeLabel
= new Label(composite
, SWT
.NONE
);
824 typeLabel
.setText(Messages
.ImportTraceWizard_TraceType
);
825 typeLabel
.setFont(parent
.getFont());
828 fTraceTypes
= new Combo(composite
, SWT
.BORDER
| SWT
.READ_ONLY
);
829 GridData data
= new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 2, 1);
830 fTraceTypes
.setLayoutData(data
);
831 fTraceTypes
.setFont(parent
.getFont());
833 String
[] availableTraceTypes
= TmfTraceType
.getAvailableTraceTypes();
834 String
[] traceTypeList
= new String
[availableTraceTypes
.length
+ 1];
835 traceTypeList
[0] = TRACE_TYPE_AUTO_DETECT
;
836 for (int i
= 0; i
< availableTraceTypes
.length
; i
++) {
837 traceTypeList
[i
+ 1] = availableTraceTypes
[i
];
839 fTraceTypes
.setItems(traceTypeList
);
840 fTraceTypes
.addSelectionListener(new SelectionAdapter() {
842 public void widgetSelected(SelectionEvent e
) {
843 updateWidgetEnablements();
844 boolean enabled
= fTraceTypes
.getText().equals(TRACE_TYPE_AUTO_DETECT
);
845 fImportUnrecognizedButton
.setEnabled(enabled
);
848 fTraceTypes
.select(0);
850 // Unrecognized checkbox
851 fImportUnrecognizedButton
= new Button(composite
, SWT
.CHECK
);
852 fImportUnrecognizedButton
.setSelection(true);
853 fImportUnrecognizedButton
.setText(Messages
.ImportTraceWizard_ImportUnrecognized
);
856 // ------------------------------------------------------------------------
858 // ------------------------------------------------------------------------
861 protected void createOptionsGroupButtons(Group optionsGroup
) {
863 // Overwrite checkbox
864 fOverwriteExistingResourcesCheckbox
= new Button(optionsGroup
, SWT
.CHECK
);
865 fOverwriteExistingResourcesCheckbox
.setFont(optionsGroup
.getFont());
866 fOverwriteExistingResourcesCheckbox
.setText(Messages
.ImportTraceWizard_OverwriteExistingTrace
);
867 fOverwriteExistingResourcesCheckbox
.setSelection(false);
869 // Create links checkbox
870 fCreateLinksInWorkspaceButton
= new Button(optionsGroup
, SWT
.CHECK
);
871 fCreateLinksInWorkspaceButton
.setFont(optionsGroup
.getFont());
872 fCreateLinksInWorkspaceButton
.setText(Messages
.ImportTraceWizard_CreateLinksInWorkspace
);
873 fCreateLinksInWorkspaceButton
.setSelection(true);
875 fCreateLinksInWorkspaceButton
.addSelectionListener(new SelectionAdapter() {
877 public void widgetSelected(SelectionEvent e
) {
878 updateWidgetEnablements();
882 fPreserveFolderStructureButton
= new Button(optionsGroup
, SWT
.CHECK
);
883 fPreserveFolderStructureButton
.setFont(optionsGroup
.getFont());
884 fPreserveFolderStructureButton
.setText(Messages
.ImportTraceWizard_PreserveFolderStructure
);
885 fPreserveFolderStructureButton
.setSelection(true);
887 Composite comp
= new Composite(optionsGroup
, SWT
.NONE
);
888 GridLayout layout
= new GridLayout(2, false);
889 layout
.marginLeft
= 0;
890 layout
.marginRight
= 0;
891 layout
.marginBottom
= 0;
892 layout
.marginTop
= 0;
893 layout
.marginWidth
= 0;
894 comp
.setLayout(layout
);
895 GridData data
= new GridData(GridData
.FILL
, GridData
.CENTER
, true, false);
896 comp
.setLayoutData(data
);
898 fCreateExperimentCheckbox
= new Button(comp
, SWT
.CHECK
);
899 fCreateExperimentCheckbox
.setFont(comp
.getFont());
900 fCreateExperimentCheckbox
.setText(Messages
.ImportTraceWizard_CreateExperiment
);
901 fCreateExperimentCheckbox
.setSelection(false);
902 data
= new GridData(GridData
.BEGINNING
, GridData
.CENTER
, false, false);
903 fCreateExperimentCheckbox
.setLayoutData(data
);
905 fExperimentNameText
= new Text(comp
, SWT
.BORDER
);
906 data
= new GridData(GridData
.FILL
, GridData
.CENTER
, true, false);
907 fExperimentNameText
.setLayoutData(data
);
909 fExperimentNameText
.addModifyListener(new ModifyListener() {
911 public void modifyText(ModifyEvent e
) {
912 updateWidgetEnablements();
916 fCreateExperimentCheckbox
.addSelectionListener(new SelectionAdapter() {
918 public void widgetSelected(SelectionEvent e
) {
919 fExperimentNameText
.setEnabled(fCreateExperimentCheckbox
.getSelection());
920 updateWidgetEnablements();
924 updateWidgetEnablements();
927 // ------------------------------------------------------------------------
928 // Determine if the finish button can be enabled
929 // ------------------------------------------------------------------------
931 public boolean validateSourceGroup() {
933 File source
= getSourceFile();
934 if (source
== null) {
935 setMessage(Messages
.ImportTraceWizard_SelectTraceSourceEmpty
);
936 setErrorMessage(null);
940 if (sourceConflictsWithDestination(new Path(source
.getPath()))) {
942 setErrorMessage(getSourceConflictMessage());
946 if (!isImportFromDirectory() && !ArchiveUtil
.ensureTarSourceIsValid(source
.getAbsolutePath()) && !ArchiveUtil
.ensureZipSourceIsValid(source
.getAbsolutePath(), getContainer().getShell())
947 && !ArchiveUtil
.ensureGzipSourceIsValid(source
.getAbsolutePath())) {
949 setErrorMessage(Messages
.ImportTraceWizard_BadArchiveFormat
);
953 if (fSelectionGroup
.getCheckedElementCount() == 0) {
955 setErrorMessage(Messages
.ImportTraceWizard_SelectTraceNoneSelected
);
959 IContainer container
= getSpecifiedContainer();
960 if (container
!= null && container
.isVirtual()) {
961 if (Platform
.getPreferencesService().getBoolean(Activator
.PLUGIN_ID
, ResourcesPlugin
.PREF_DISABLE_LINKING
, false, null)) {
963 setErrorMessage(Messages
.ImportTraceWizard_CannotImportFilesUnderAVirtualFolder
);
966 if (fCreateLinksInWorkspaceButton
== null || !fCreateLinksInWorkspaceButton
.getSelection()) {
968 setErrorMessage(Messages
.ImportTraceWizard_HaveToCreateLinksUnderAVirtualFolder
);
972 setErrorMessage(null);
977 protected boolean validateOptionsGroup() {
978 if (fCreateExperimentCheckbox
!= null && fCreateExperimentCheckbox
.getSelection()) {
979 String name
= fExperimentNameText
.getText().trim();
980 // verify if experiment name is empty
981 if (name
.isEmpty()) {
983 setErrorMessage(Messages
.ImportTraceWizard_ErrorEmptyExperimentName
);
986 // verify that name is a valid resource name
987 IWorkspace workspace
= ResourcesPlugin
.getWorkspace();
988 if ((workspace
!= null) && (!workspace
.validateName(name
, IResource
.FILE
).isOK())) {
990 setErrorMessage(NLS
.bind(Messages
.ImportTraceWizard_ErrorExperimentNameInvalid
, name
));
993 // verify if experiment already exists
994 if (fExperimentFolderElement
!= null) {
995 TmfExperimentElement element
= fExperimentFolderElement
.getExperiment(name
);
996 if (element
!= null) {
998 setErrorMessage(NLS
.bind(Messages
.ImportTraceWizard_ErrorExperimentAlreadyExists
, name
));
1001 IFolder expResource
= fExperimentFolderElement
.getResource();
1002 IResource res
= expResource
.findMember(name
);
1005 setErrorMessage(NLS
.bind(Messages
.ImportTraceWizard_ErrorResourceAlreadyExists
, name
));
1010 setErrorMessage(null);
1014 private File
getSourceFile() {
1015 return isImportFromDirectory() ?
getSourceDirectory() : getSourceArchiveFile();
1018 private boolean isImportFromDirectory() {
1019 return fImportFromDirectoryRadio
!= null && fImportFromDirectoryRadio
.getSelection();
1023 protected void restoreWidgetValues() {
1024 super.restoreWidgetValues();
1026 IDialogSettings settings
= getDialogSettings();
1028 if (fImportUnrecognizedButton
!= null) {
1029 if (settings
.get(getPageStoreKey(IMPORT_WIZARD_IMPORT_UNRECOGNIZED_ID
)) == null) {
1032 value
= settings
.getBoolean(getPageStoreKey(IMPORT_WIZARD_IMPORT_UNRECOGNIZED_ID
));
1034 fImportUnrecognizedButton
.setSelection(value
);
1037 if (fPreserveFolderStructureButton
!= null) {
1038 if (settings
.get(getPageStoreKey(IMPORT_WIZARD_PRESERVE_FOLDERS_ID
)) == null) {
1041 value
= settings
.getBoolean(getPageStoreKey(IMPORT_WIZARD_PRESERVE_FOLDERS_ID
));
1043 fPreserveFolderStructureButton
.setSelection(value
);
1046 if (fCreateExperimentCheckbox
!= null) {
1047 if (settings
.get(getPageStoreKey(IMPORT_WIZARD_CREATE_EXPERIMENT_ID
)) == null) {
1050 value
= settings
.getBoolean(getPageStoreKey(IMPORT_WIZARD_CREATE_EXPERIMENT_ID
));
1052 fCreateExperimentCheckbox
.setSelection(value
);
1053 fExperimentNameText
.setEnabled(fCreateExperimentCheckbox
.getSelection());
1056 if (settings
.get(getPageStoreKey(IMPORT_WIZARD_IMPORT_FROM_DIRECTORY_ID
)) == null) {
1059 value
= settings
.getBoolean(getPageStoreKey(IMPORT_WIZARD_IMPORT_FROM_DIRECTORY_ID
));
1062 if (directoryNameField
!= null) {
1063 restoreComboValues(directoryNameField
, settings
, getPageStoreKey(IMPORT_WIZARD_ROOT_DIRECTORY_ID
));
1065 if (fArchiveNameField
!= null) {
1066 restoreComboValues(fArchiveNameField
, settings
, getPageStoreKey(IMPORT_WIZARD_ARCHIVE_FILE_NAME_ID
));
1069 if (fImportFromDirectoryRadio
!= null) {
1070 fImportFromDirectoryRadio
.setSelection(value
);
1072 directoryRadioSelected();
1075 if (fImportFromArchiveRadio
!= null) {
1076 fImportFromArchiveRadio
.setSelection(!value
);
1078 archiveRadioSelected();
1084 protected void saveWidgetValues() {
1085 // Persist dialog settings
1086 IDialogSettings settings
= getDialogSettings();
1087 if (fImportUnrecognizedButton
!= null) {
1088 settings
.put(getPageStoreKey(IMPORT_WIZARD_IMPORT_UNRECOGNIZED_ID
), fImportUnrecognizedButton
.getSelection());
1090 if (fPreserveFolderStructureButton
!= null) {
1091 settings
.put(getPageStoreKey(IMPORT_WIZARD_PRESERVE_FOLDERS_ID
), fPreserveFolderStructureButton
.getSelection());
1094 if (fCreateExperimentCheckbox
!= null) {
1095 settings
.put(getPageStoreKey(IMPORT_WIZARD_CREATE_EXPERIMENT_ID
), fCreateExperimentCheckbox
.getSelection());
1098 settings
.put(getPageStoreKey(IMPORT_WIZARD_IMPORT_FROM_DIRECTORY_ID
), isImportFromDirectory());
1100 if (directoryNameField
!= null) {
1101 saveComboValues(directoryNameField
, settings
, getPageStoreKey(IMPORT_WIZARD_ROOT_DIRECTORY_ID
));
1103 if (fArchiveNameField
!= null) {
1104 saveComboValues(fArchiveNameField
, settings
, getPageStoreKey(IMPORT_WIZARD_ARCHIVE_FILE_NAME_ID
));
1108 private String
getPageStoreKey(String key
) {
1109 return getName() + key
;
1112 private static void restoreComboValues(Combo combo
, IDialogSettings settings
, String key
) {
1113 String
[] directoryNames
= settings
.getArray(key
);
1114 if ((directoryNames
!= null) && (directoryNames
.length
!= 0)) {
1115 for (int i
= 0; i
< directoryNames
.length
; i
++) {
1116 combo
.add(directoryNames
[i
]);
1121 private void saveComboValues(Combo combo
, IDialogSettings settings
, String key
) {
1122 // update names history
1123 String
[] directoryNames
= settings
.getArray(key
);
1124 if (directoryNames
== null) {
1125 directoryNames
= new String
[0];
1128 String items
[] = combo
.getItems();
1129 for (int i
= 0; i
< items
.length
; i
++) {
1130 directoryNames
= addToHistory(directoryNames
, items
[i
]);
1132 settings
.put(key
, directoryNames
);
1135 // ------------------------------------------------------------------------
1136 // Import the trace(s)
1137 // ------------------------------------------------------------------------
1140 * Finish the import.
1142 * @return <code>true</code> if successful else <code>false</code>
1144 public boolean finish() {
1145 String traceTypeLabel
= getImportTraceTypeId();
1146 final String traceId
= !TRACE_TYPE_AUTO_DETECT
.equals(traceTypeLabel
) ? TmfTraceType
.getTraceTypeId(traceTypeLabel
) : null;
1148 // Save dialog settings
1151 final IPath baseSourceContainerPath
= new Path(getSourceContainerPath());
1152 final boolean importFromArchive
= getSourceArchiveFile() != null;
1153 final int importOptionFlags
= getImportOptionFlags();
1154 final IPath destinationContainerPath
= getContainerFullPath();
1156 final IStatus
[] operationStatus
= new IStatus
[1];
1157 operationStatus
[0] = Status
.OK_STATUS
;
1158 final List
<IResource
> traceResources
= new ArrayList
<>();
1160 getContainer().run(true, true, new IRunnableWithProgress() {
1162 public void run(IProgressMonitor monitor
) throws InvocationTargetException
, InterruptedException
{
1164 final List
<TraceFileSystemElement
> selectedFileSystemElements
= new LinkedList
<>();
1165 IElementFilter passThroughFilter
= new IElementFilter() {
1168 public void filterElements(Collection elements
, IProgressMonitor m
) {
1169 selectedFileSystemElements
.addAll(elements
);
1173 public void filterElements(Object
[] elements
, IProgressMonitor m
) {
1174 for (int i
= 0; i
< elements
.length
; i
++) {
1175 selectedFileSystemElements
.add((TraceFileSystemElement
) elements
[i
]);
1180 // List fileSystemElements will be filled using the
1181 // passThroughFilter
1182 SubMonitor subMonitor
= SubMonitor
.convert(monitor
, 1);
1183 fSelectionGroup
.getAllCheckedListItems(passThroughFilter
, subMonitor
);
1185 final TraceValidateAndImportOperation operation
= new TraceValidateAndImportOperation(getContainer().getShell(), selectedFileSystemElements
, traceId
, baseSourceContainerPath
, destinationContainerPath
, importFromArchive
,
1186 importOptionFlags
, fTraceFolderElement
);
1187 operation
.run(monitor
);
1189 operationStatus
[0] = operation
.getStatus();
1190 traceResources
.addAll(operation
.getImportedResources());
1194 // Only create experiment when option is selected and
1195 // if there has been at least one trace imported
1196 if (((importOptionFlags
& OPTION_CREATE_EXPERIMENT
) != 0) && (traceResources
.size() > 0)) {
1197 final IFolder
[] experimentFolders
= new IFolder
[1];
1198 final TmfExperimentFolder root
= fExperimentFolderElement
;
1199 final String experimentName
= fExperimentNameText
.getText().trim();
1200 // just safety guards
1201 if ((root
== null) || (experimentName
== null)) {
1204 if ((operationStatus
[0] != null) && (operationStatus
[0].isOK())) {
1205 getContainer().run(true, true, new IRunnableWithProgress() {
1207 public void run(IProgressMonitor monitor
) throws InvocationTargetException
, InterruptedException
{
1208 operationStatus
[0] = null;
1209 final NewExperimentOperation operation
= new NewExperimentOperation(root
, experimentName
);
1210 operation
.run(monitor
);
1212 operationStatus
[0] = operation
.getStatus();
1213 experimentFolders
[0] = operation
.getExperimentFolder();
1217 final IFolder expFolder
= experimentFolders
[0];
1218 final TmfTraceFolder parentTraceFolder
= fTraceFolderElement
;
1219 // just safety guards
1220 if ((expFolder
== null) || (parentTraceFolder
== null)) {
1223 if ((operationStatus
[0] != null) && (operationStatus
[0].isOK())) {
1224 getContainer().run(true, true, new IRunnableWithProgress() {
1226 public void run(IProgressMonitor monitor
) throws InvocationTargetException
, InterruptedException
{
1227 operationStatus
[0] = null;
1228 final SelectTracesOperation operation
= new SelectTracesOperation(root
, expFolder
, parentTraceFolder
, traceResources
);
1229 operation
.run(monitor
);
1231 operationStatus
[0] = operation
.getStatus();
1237 } catch (InvocationTargetException e
) {
1238 operationStatus
[0] = new Status(IStatus
.ERROR
, Activator
.PLUGIN_ID
, Messages
.ImportTraceWizard_ImportProblem
, e
.getTargetException());
1239 } catch (InterruptedException e
) {
1240 operationStatus
[0] = Status
.CANCEL_STATUS
;
1242 if (!operationStatus
[0].isOK()) {
1243 if (operationStatus
[0].getSeverity() == IStatus
.CANCEL
) {
1244 setMessage(Messages
.ImportTraceWizard_ImportOperationCancelled
);
1245 setErrorMessage(null);
1247 Throwable exception
= operationStatus
[0].getException();
1248 if (exception
!= null) {
1249 Activator
.getDefault().logError(exception
.getMessage(), exception
);
1250 displayErrorDialog(operationStatus
[0].getMessage() + ": " + exception
); //$NON-NLS-1$
1253 setErrorMessage(Messages
.ImportTraceWizard_ImportProblem
);
1257 setErrorMessage(null);
1262 * Get the trace type id to import as. This can also return
1263 * {@link #TRACE_TYPE_AUTO_DETECT} to communicate that automatic trace type
1264 * detection will occur instead of setting a specific trace type when
1265 * importing the traces.
1267 * @return the trace type id or {@link #TRACE_TYPE_AUTO_DETECT}
1269 protected String
getImportTraceTypeId() {
1270 return fTraceTypes
.getText();
1274 * Get import options in the form of flags (bits).
1276 * @return the import flags.
1277 * @see #OPTION_CREATE_LINKS_IN_WORKSPACE
1278 * @see #OPTION_IMPORT_UNRECOGNIZED_TRACES
1279 * @see #OPTION_OVERWRITE_EXISTING_RESOURCES
1280 * @see #OPTION_PRESERVE_FOLDER_STRUCTURE
1281 * @see #OPTION_CREATE_EXPERIMENT
1283 protected int getImportOptionFlags() {
1285 if (fCreateLinksInWorkspaceButton
!= null && fCreateLinksInWorkspaceButton
.getSelection()) {
1286 flags
|= OPTION_CREATE_LINKS_IN_WORKSPACE
;
1288 if (fImportUnrecognizedButton
!= null && fImportUnrecognizedButton
.getSelection()) {
1289 flags
|= OPTION_IMPORT_UNRECOGNIZED_TRACES
;
1291 if (fOverwriteExistingResourcesCheckbox
!= null && fOverwriteExistingResourcesCheckbox
.getSelection()) {
1292 flags
|= OPTION_OVERWRITE_EXISTING_RESOURCES
;
1294 if (fPreserveFolderStructureButton
!= null && fPreserveFolderStructureButton
.getSelection()) {
1295 flags
|= OPTION_PRESERVE_FOLDER_STRUCTURE
;
1297 if (fCreateExperimentCheckbox
!= null && fCreateExperimentCheckbox
.getSelection()) {
1298 flags
|= OPTION_CREATE_EXPERIMENT
;
1304 public void dispose() {
1306 disposeSelectionGroupRoot();