1 /*******************************************************************************
2 * Copyright (c) 2009, 2014 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 *******************************************************************************/
20 package org
.eclipse
.linuxtools
.internal
.tmf
.ui
.project
.wizards
.importtrace
;
23 import java
.io
.InputStream
;
24 import java
.lang
.reflect
.InvocationTargetException
;
25 import java
.util
.ArrayList
;
26 import java
.util
.Collection
;
27 import java
.util
.HashMap
;
28 import java
.util
.Iterator
;
29 import java
.util
.List
;
32 import org
.eclipse
.core
.resources
.IContainer
;
33 import org
.eclipse
.core
.resources
.IFolder
;
34 import org
.eclipse
.core
.resources
.IProject
;
35 import org
.eclipse
.core
.resources
.IResource
;
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
.core
.runtime
.SubProgressMonitor
;
47 import org
.eclipse
.core
.runtime
.URIUtil
;
48 import org
.eclipse
.jface
.dialogs
.IDialogSettings
;
49 import org
.eclipse
.jface
.dialogs
.MessageDialog
;
50 import org
.eclipse
.jface
.operation
.IRunnableWithProgress
;
51 import org
.eclipse
.jface
.operation
.ModalContext
;
52 import org
.eclipse
.jface
.viewers
.CheckStateChangedEvent
;
53 import org
.eclipse
.jface
.viewers
.ICheckStateListener
;
54 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
55 import org
.eclipse
.jface
.viewers
.ITreeContentProvider
;
56 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.Activator
;
57 import org
.eclipse
.linuxtools
.tmf
.core
.TmfCommonConstants
;
58 import org
.eclipse
.linuxtools
.tmf
.core
.TmfProjectNature
;
59 import org
.eclipse
.linuxtools
.tmf
.core
.project
.model
.TmfTraceImportException
;
60 import org
.eclipse
.linuxtools
.tmf
.core
.project
.model
.TmfTraceType
;
61 import org
.eclipse
.linuxtools
.tmf
.core
.project
.model
.TraceTypeHelper
;
62 import org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
.TmfProjectElement
;
63 import org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
.TmfProjectRegistry
;
64 import org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
.TmfTraceElement
;
65 import org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
.TmfTraceFolder
;
66 import org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
.TmfTraceTypeUIUtils
;
67 import org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
.TmfTracesFolder
;
68 import org
.eclipse
.osgi
.util
.NLS
;
69 import org
.eclipse
.swt
.SWT
;
70 import org
.eclipse
.swt
.custom
.BusyIndicator
;
71 import org
.eclipse
.swt
.events
.FocusEvent
;
72 import org
.eclipse
.swt
.events
.FocusListener
;
73 import org
.eclipse
.swt
.events
.KeyEvent
;
74 import org
.eclipse
.swt
.events
.KeyListener
;
75 import org
.eclipse
.swt
.events
.ModifyEvent
;
76 import org
.eclipse
.swt
.events
.ModifyListener
;
77 import org
.eclipse
.swt
.events
.SelectionAdapter
;
78 import org
.eclipse
.swt
.events
.SelectionEvent
;
79 import org
.eclipse
.swt
.layout
.GridData
;
80 import org
.eclipse
.swt
.layout
.GridLayout
;
81 import org
.eclipse
.swt
.widgets
.Button
;
82 import org
.eclipse
.swt
.widgets
.Combo
;
83 import org
.eclipse
.swt
.widgets
.Composite
;
84 import org
.eclipse
.swt
.widgets
.DirectoryDialog
;
85 import org
.eclipse
.swt
.widgets
.Event
;
86 import org
.eclipse
.swt
.widgets
.Group
;
87 import org
.eclipse
.swt
.widgets
.Label
;
88 import org
.eclipse
.ui
.IWorkbench
;
89 import org
.eclipse
.ui
.dialogs
.FileSystemElement
;
90 import org
.eclipse
.ui
.dialogs
.IOverwriteQuery
;
91 import org
.eclipse
.ui
.dialogs
.WizardResourceImportPage
;
92 import org
.eclipse
.ui
.internal
.ide
.DialogUtil
;
93 import org
.eclipse
.ui
.internal
.ide
.dialogs
.IElementFilter
;
94 import org
.eclipse
.ui
.model
.AdaptableList
;
95 import org
.eclipse
.ui
.model
.WorkbenchContentProvider
;
96 import org
.eclipse
.ui
.model
.WorkbenchLabelProvider
;
97 import org
.eclipse
.ui
.model
.WorkbenchViewerComparator
;
98 import org
.eclipse
.ui
.wizards
.datatransfer
.FileSystemStructureProvider
;
99 import org
.eclipse
.ui
.wizards
.datatransfer
.IImportStructureProvider
;
100 import org
.eclipse
.ui
.wizards
.datatransfer
.ImportOperation
;
103 * A variant of the standard resource import wizard for importing traces
104 * to given tracing project. If no project or tracing project was selected
105 * the wizard imports it to the default tracing project which is created
108 * In our case traces could be files or a directory structure. This wizard
109 * supports both cases. It imports traces for a selected trace type or, if
110 * no trace type is selected, it tries to detect the trace type automatically.
111 * However, the automatic detection is a best-effort and cannot guarantee
112 * that the detection is successful. The reason for this is that there might
113 * be multiple trace types that can be assigned to a single trace.
116 * @author Francois Chouinard
119 @SuppressWarnings("restriction")
120 public class ImportTraceWizardPage
extends WizardResourceImportPage
{
122 // ------------------------------------------------------------------------
124 // ------------------------------------------------------------------------
125 private static final String IMPORT_WIZARD_PAGE
= "ImportTraceWizardPage"; //$NON-NLS-1$
126 private static final String IMPORT_WIZARD_ROOT_DIRECTORY_ID
= IMPORT_WIZARD_PAGE
+ ".import_root_directory_id"; //$NON-NLS-1$
127 private static final String IMPORT_WIZARD_IMPORT_UNRECOGNIZED_ID
= IMPORT_WIZARD_PAGE
+ ".import_unrecognized_traces_id"; //$NON-NLS-1$
128 private static final String IMPORT_WIZARD_PRESERVE_FOLDERS_ID
= IMPORT_WIZARD_PAGE
+ ".import_preserve_folders_id"; //$NON-NLS-1$
129 private static final String SEPARATOR
= ":"; //$NON-NLS-1$
130 private static final String AUTO_DETECT
= Messages
.ImportTraceWizard_AutoDetection
;
132 // ------------------------------------------------------------------------
134 // ------------------------------------------------------------------------
136 // Target import directory ('Traces' folder)
137 private IFolder fTargetFolder
;
138 // Target Trace folder element
139 private TmfTraceFolder fTraceFolderElement
;
140 // Flag to handle destination folder change event
141 private Boolean fIsDestinationChanged
= false;
142 // Combo box containing trace types
143 private Combo fTraceTypes
;
144 // Button to ignore unrecognized traces or not
145 private Button fImportUnrecognizedButton
;
146 // Button to overwrite existing resources or not
147 private Button fOverwriteExistingResourcesCheckbox
;
148 // Button to link or copy traces to workspace
149 private Button fCreateLinksInWorkspaceButton
;
150 // Button to preserve folder structure
151 private Button fPreserveFolderStructureButton
;
152 private boolean entryChanged
= false;
153 /** The directory name field */
154 protected Combo directoryNameField
;
155 /** The directory browse button. */
156 protected Button directoryBrowseButton
;
159 * ResourceTreeAndListGroup was internal in Kepler and we referenced it. It
160 * is now removed in Luna. To keep our builds compatible with Kepler, we
161 * need to have our own version of this class. Once we stop supporting
162 * Kepler, we can delete this class and use the public one from the
165 private ResourceTreeAndListGroup fSelectionGroup
;
167 // ------------------------------------------------------------------------
169 // ------------------------------------------------------------------------
172 * Constructor. Creates the trace wizard page.
175 * The name of the page.
177 * The current selection
179 protected ImportTraceWizardPage(String name
, IStructuredSelection selection
) {
180 super(name
, selection
);
184 * Create the import source selection widget. (Copied from WizardResourceImportPage
185 * but instead always uses the internal ResourceTreeAndListGroup to keep compatibility
189 protected void createFileSelectionGroup(Composite parent
) {
191 //Just create with a dummy root.
192 fSelectionGroup
= new ResourceTreeAndListGroup(parent
,
193 new FileSystemElement("Dummy", null, true),//$NON-NLS-1$
194 getFolderProvider(), new WorkbenchLabelProvider(),
195 getFileProvider(), new WorkbenchLabelProvider(), SWT
.NONE
,
196 DialogUtil
.inRegularFontMode(parent
));
198 ICheckStateListener listener
= new ICheckStateListener() {
200 public void checkStateChanged(CheckStateChangedEvent event
) {
201 updateWidgetEnablements();
205 WorkbenchViewerComparator comparator
= new WorkbenchViewerComparator();
206 fSelectionGroup
.setTreeComparator(comparator
);
207 fSelectionGroup
.setListComparator(comparator
);
208 fSelectionGroup
.addCheckStateListener(listener
);
216 * The workbench reference.
218 * The current selection
220 public ImportTraceWizardPage(IWorkbench workbench
, IStructuredSelection selection
) {
221 this(IMPORT_WIZARD_PAGE
, selection
);
222 setTitle(Messages
.ImportTraceWizard_FileSystemTitle
);
223 setDescription(Messages
.ImportTraceWizard_ImportTrace
);
225 // Locate the target trace folder
226 IFolder traceFolder
= null;
227 Object element
= selection
.getFirstElement();
229 if (element
instanceof TmfTraceFolder
) {
230 fTraceFolderElement
= (TmfTraceFolder
) element
;
231 traceFolder
= fTraceFolderElement
.getResource();
232 } else if (element
instanceof IProject
) {
233 IProject project
= (IProject
) element
;
235 if (project
.hasNature(TmfProjectNature
.ID
)) {
236 TmfProjectElement projectElement
= TmfProjectRegistry
.getProject(project
, true);
237 fTraceFolderElement
= projectElement
.getTracesFolder();
238 traceFolder
= project
.getFolder(TmfTracesFolder
.TRACES_FOLDER_NAME
);
240 } catch (CoreException e
) {
244 // If no tracing project was selected or trace folder doesn't exist use
245 // default tracing project
246 if (traceFolder
== null) {
247 IProject project
= TmfProjectRegistry
.createProject(
248 TmfCommonConstants
.DEFAULT_TRACE_PROJECT_NAME
, null, new NullProgressMonitor());
249 TmfProjectElement projectElement
= TmfProjectRegistry
.getProject(project
, true);
250 fTraceFolderElement
= projectElement
.getTracesFolder();
251 traceFolder
= project
.getFolder(TmfTracesFolder
.TRACES_FOLDER_NAME
);
254 // Set the target trace folder
255 if (traceFolder
!= null) {
256 fTargetFolder
= traceFolder
;
257 String path
= traceFolder
.getFullPath().toString();
258 setContainerFieldValue(path
);
262 // ------------------------------------------------------------------------
263 // WizardResourceImportPage
264 // ------------------------------------------------------------------------
267 protected void createSourceGroup(Composite parent
) {
268 createDirectorySelectionGroup(parent
);
269 createFileSelectionGroup(parent
);
270 createTraceTypeGroup(parent
);
271 validateSourceGroup();
275 protected ITreeContentProvider
getFileProvider() {
276 return new WorkbenchContentProvider() {
278 public Object
[] getChildren(Object object
) {
279 if (object
instanceof TraceFileSystemElement
) {
280 TraceFileSystemElement element
= (TraceFileSystemElement
) object
;
281 return element
.getFiles().getChildren(element
);
283 return new Object
[0];
289 protected ITreeContentProvider
getFolderProvider() {
290 return new WorkbenchContentProvider() {
292 public Object
[] getChildren(Object o
) {
293 if (o
instanceof TraceFileSystemElement
) {
294 TraceFileSystemElement element
= (TraceFileSystemElement
) o
;
295 return element
.getFolders().getChildren();
297 return new Object
[0];
301 public boolean hasChildren(Object o
) {
302 if (o
instanceof TraceFileSystemElement
) {
303 TraceFileSystemElement element
= (TraceFileSystemElement
) o
;
304 if (element
.isPopulated()) {
305 return getChildren(element
).length
> 0;
307 //If we have not populated then wait until asked
315 // ------------------------------------------------------------------------
316 // Directory Selection Group (forked WizardFileSystemResourceImportPage1)
317 // ------------------------------------------------------------------------
320 * creates the directory selection group.
323 * the parent composite
325 protected void createDirectorySelectionGroup(Composite parent
) {
327 Composite directoryContainerGroup
= new Composite(parent
, SWT
.NONE
);
328 GridLayout layout
= new GridLayout();
329 layout
.numColumns
= 3;
330 directoryContainerGroup
.setLayout(layout
);
331 directoryContainerGroup
.setFont(parent
.getFont());
332 directoryContainerGroup
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, false));
334 // Label ("Trace directory:")
335 Label groupLabel
= new Label(directoryContainerGroup
, SWT
.NONE
);
336 groupLabel
.setText(Messages
.ImportTraceWizard_DirectoryLocation
);
337 groupLabel
.setFont(parent
.getFont());
339 // Directory name entry field
340 directoryNameField
= new Combo(directoryContainerGroup
, SWT
.BORDER
);
341 GridData data
= new GridData(SWT
.FILL
, SWT
.FILL
, true, false);
342 data
.widthHint
= SIZING_TEXT_FIELD_WIDTH
;
343 directoryNameField
.setLayoutData(data
);
344 directoryNameField
.setFont(parent
.getFont());
346 directoryNameField
.addSelectionListener(new SelectionAdapter() {
348 public void widgetSelected(SelectionEvent e
) {
349 updateFromSourceField();
353 directoryNameField
.addKeyListener(new KeyListener() {
355 public void keyPressed(KeyEvent e
) {
356 if (e
.character
== SWT
.CR
) { // Windows...
357 entryChanged
= false;
358 updateFromSourceField();
363 public void keyReleased(KeyEvent e
) {
367 directoryNameField
.addFocusListener(new FocusListener() {
369 public void focusGained(FocusEvent e
) {
370 // Do nothing when getting focus
373 public void focusLost(FocusEvent e
) {
374 // Clear the flag to prevent constant update
376 entryChanged
= false;
377 updateFromSourceField();
382 directoryNameField
.addModifyListener(new ModifyListener() {
384 public void modifyText(ModifyEvent e
) {
390 directoryBrowseButton
= new Button(directoryContainerGroup
, SWT
.PUSH
);
391 directoryBrowseButton
.setText(Messages
.ImportTraceWizard_BrowseButton
);
392 directoryBrowseButton
.addListener(SWT
.Selection
, this);
393 directoryBrowseButton
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, false, false));
394 directoryBrowseButton
.setFont(parent
.getFont());
395 setButtonLayoutData(directoryBrowseButton
);
398 // ------------------------------------------------------------------------
399 // Browse for the source directory
400 // ------------------------------------------------------------------------
403 public void handleEvent(Event event
) {
404 if (event
.widget
== directoryBrowseButton
) {
405 handleSourceDirectoryBrowseButtonPressed();
408 // Avoid overwriting destination path without repeatedly trigger
409 // call of handleEvent();
410 synchronized (fIsDestinationChanged
) {
411 if (fIsDestinationChanged
== false) {
412 event
.display
.asyncExec(new Runnable() {
415 synchronized (fIsDestinationChanged
) {
416 fIsDestinationChanged
= true;
417 String path
= fTargetFolder
.getFullPath().toString();
418 setContainerFieldValue(path
);
423 fIsDestinationChanged
= false;
426 super.handleEvent(event
);
430 protected void handleContainerBrowseButtonPressed() {
431 // Do nothing so that destination directory cannot be changed.
435 * Handle the button pressed event
437 protected void handleSourceDirectoryBrowseButtonPressed() {
438 String currentSource
= directoryNameField
.getText();
439 DirectoryDialog dialog
= new DirectoryDialog(directoryNameField
.getShell(), SWT
.SAVE
| SWT
.SHEET
);
440 dialog
.setText(Messages
.ImportTraceWizard_SelectTraceDirectoryTitle
);
441 dialog
.setMessage(Messages
.ImportTraceWizard_SelectTraceDirectoryMessage
);
442 dialog
.setFilterPath(getSourceDirectoryName(currentSource
));
444 String selectedDirectory
= dialog
.open();
445 if (selectedDirectory
!= null) {
446 // Just quit if the directory is not valid
447 if ((getSourceDirectory(selectedDirectory
) == null) || selectedDirectory
.equals(currentSource
)) {
450 // If it is valid then proceed to populate
451 setErrorMessage(null);
452 setSourceName(selectedDirectory
);
456 private File
getSourceDirectory() {
457 return getSourceDirectory(directoryNameField
.getText());
460 private static File
getSourceDirectory(String path
) {
461 File sourceDirectory
= new File(getSourceDirectoryName(path
));
462 if (!sourceDirectory
.exists() || !sourceDirectory
.isDirectory()) {
466 return sourceDirectory
;
469 private static String
getSourceDirectoryName(String sourceName
) {
470 IPath result
= new Path(sourceName
.trim());
471 if (result
.getDevice() != null && result
.segmentCount() == 0) {
472 result
= result
.addTrailingSeparator();
474 result
= result
.removeTrailingSeparator();
476 return result
.toOSString();
479 private void updateFromSourceField() {
480 setSourceName(directoryNameField
.getText());
481 updateWidgetEnablements();
484 private void setSourceName(String path
) {
485 if (path
.length() > 0) {
486 String
[] currentItems
= directoryNameField
.getItems();
487 int selectionIndex
= -1;
488 for (int i
= 0; i
< currentItems
.length
; i
++) {
489 if (currentItems
[i
].equals(path
)) {
493 if (selectionIndex
< 0) {
494 int oldLength
= currentItems
.length
;
495 String
[] newItems
= new String
[oldLength
+ 1];
496 System
.arraycopy(currentItems
, 0, newItems
, 0, oldLength
);
497 newItems
[oldLength
] = path
;
498 directoryNameField
.setItems(newItems
);
499 selectionIndex
= oldLength
;
501 directoryNameField
.select(selectionIndex
);
506 // ------------------------------------------------------------------------
507 // File Selection Group (forked WizardFileSystemResourceImportPage1)
508 // ------------------------------------------------------------------------
509 private void resetSelection() {
510 TraceFileSystemElement root
= getFileSystemTree();
511 fSelectionGroup
.setRoot(root
);
514 private TraceFileSystemElement
getFileSystemTree() {
515 File sourceDirectory
= getSourceDirectory();
516 if (sourceDirectory
== null) {
519 return selectFiles(sourceDirectory
, FileSystemStructureProvider
.INSTANCE
);
522 private TraceFileSystemElement
selectFiles(final Object rootFileSystemObject
,
523 final IImportStructureProvider structureProvider
) {
524 final TraceFileSystemElement
[] results
= new TraceFileSystemElement
[1];
525 BusyIndicator
.showWhile(getShell().getDisplay(), new Runnable() {
528 // Create the root element from the supplied file system object
529 results
[0] = createRootElement(rootFileSystemObject
, structureProvider
);
535 private static TraceFileSystemElement
createRootElement(Object fileSystemObject
,
536 IImportStructureProvider provider
) {
538 boolean isContainer
= provider
.isFolder(fileSystemObject
);
539 String elementLabel
= provider
.getLabel(fileSystemObject
);
541 // Use an empty label so that display of the element's full name
542 // doesn't include a confusing label
543 TraceFileSystemElement dummyParent
= new TraceFileSystemElement("", null, true);//$NON-NLS-1$
544 dummyParent
.setFileSystemObject(((File
)fileSystemObject
).getParentFile());
545 dummyParent
.setPopulated();
546 TraceFileSystemElement result
= new TraceFileSystemElement(
547 elementLabel
, dummyParent
, isContainer
);
548 result
.setFileSystemObject(fileSystemObject
);
550 //Get the files for the element so as to build the first level
556 // ------------------------------------------------------------------------
558 // ------------------------------------------------------------------------
559 private final void createTraceTypeGroup(Composite parent
) {
560 Composite composite
= new Composite(parent
, SWT
.NONE
);
561 GridLayout layout
= new GridLayout();
562 layout
.numColumns
= 3;
563 layout
.makeColumnsEqualWidth
= false;
564 composite
.setLayout(layout
);
565 composite
.setFont(parent
.getFont());
566 GridData buttonData
= new GridData(SWT
.FILL
, SWT
.FILL
, true, false);
567 composite
.setLayoutData(buttonData
);
569 // Trace type label ("Trace Type:")
570 Label typeLabel
= new Label(composite
, SWT
.NONE
);
571 typeLabel
.setText(Messages
.ImportTraceWizard_TraceType
);
572 typeLabel
.setFont(parent
.getFont());
575 fTraceTypes
= new Combo(composite
, SWT
.BORDER
| SWT
.READ_ONLY
);
576 GridData data
= new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 2, 1);
577 fTraceTypes
.setLayoutData(data
);
578 fTraceTypes
.setFont(parent
.getFont());
580 String
[] availableTraceTypes
= TmfTraceType
.getInstance().getAvailableTraceTypes();
581 String
[] traceTypeList
= new String
[availableTraceTypes
.length
+ 1];
582 traceTypeList
[0] = AUTO_DETECT
;
583 for (int i
= 0; i
< availableTraceTypes
.length
; i
++) {
584 traceTypeList
[i
+ 1] = availableTraceTypes
[i
];
586 fTraceTypes
.setItems(traceTypeList
);
587 fTraceTypes
.addSelectionListener(new SelectionAdapter() {
589 public void widgetSelected(SelectionEvent e
) {
590 updateWidgetEnablements();
591 boolean enabled
= fTraceTypes
.getText().equals(AUTO_DETECT
);
592 fImportUnrecognizedButton
.setEnabled(enabled
);
595 fTraceTypes
.select(0);
597 // Unrecognized checkbox
598 fImportUnrecognizedButton
= new Button(composite
, SWT
.CHECK
);
599 fImportUnrecognizedButton
.setSelection(true);
600 fImportUnrecognizedButton
.setText(Messages
.ImportTraceWizard_ImportUnrecognized
);
603 // ------------------------------------------------------------------------
605 // ------------------------------------------------------------------------
608 protected void createOptionsGroupButtons(Group optionsGroup
) {
610 // Overwrite checkbox
611 fOverwriteExistingResourcesCheckbox
= new Button(optionsGroup
, SWT
.CHECK
);
612 fOverwriteExistingResourcesCheckbox
.setFont(optionsGroup
.getFont());
613 fOverwriteExistingResourcesCheckbox
.setText(Messages
.ImportTraceWizard_OverwriteExistingTrace
);
614 fOverwriteExistingResourcesCheckbox
.setSelection(false);
616 // Create links checkbox
617 fCreateLinksInWorkspaceButton
= new Button(optionsGroup
, SWT
.CHECK
);
618 fCreateLinksInWorkspaceButton
.setFont(optionsGroup
.getFont());
619 fCreateLinksInWorkspaceButton
.setText(Messages
.ImportTraceWizard_CreateLinksInWorkspace
);
620 fCreateLinksInWorkspaceButton
.setSelection(true);
622 fCreateLinksInWorkspaceButton
.addSelectionListener(new SelectionAdapter() {
624 public void widgetSelected(SelectionEvent e
) {
625 updateWidgetEnablements();
629 fPreserveFolderStructureButton
= new Button(optionsGroup
, SWT
.CHECK
);
630 fPreserveFolderStructureButton
.setFont(optionsGroup
.getFont());
631 fPreserveFolderStructureButton
.setText(Messages
.ImportTraceWizard_PreserveFolderStructure
);
632 fPreserveFolderStructureButton
.setSelection(true);
634 updateWidgetEnablements();
637 // ------------------------------------------------------------------------
638 // Determine if the finish button can be enabled
639 // ------------------------------------------------------------------------
641 public boolean validateSourceGroup() {
643 File sourceDirectory
= getSourceDirectory();
644 if (sourceDirectory
== null) {
645 setMessage(Messages
.ImportTraceWizard_SelectTraceSourceEmpty
);
649 if (sourceConflictsWithDestination(new Path(sourceDirectory
.getPath()))) {
651 setErrorMessage(getSourceConflictMessage());
655 if (fSelectionGroup
.getCheckedElementCount() == 0) {
657 setErrorMessage(Messages
.ImportTraceWizard_SelectTraceNoneSelected
);
661 IContainer container
= getSpecifiedContainer();
662 if (container
!= null && container
.isVirtual()) {
663 if (Platform
.getPreferencesService().getBoolean(Activator
.PLUGIN_ID
, ResourcesPlugin
.PREF_DISABLE_LINKING
, false, null)) {
665 setErrorMessage(Messages
.ImportTraceWizard_CannotImportFilesUnderAVirtualFolder
);
668 if (fCreateLinksInWorkspaceButton
== null || !fCreateLinksInWorkspaceButton
.getSelection()) {
670 setErrorMessage(Messages
.ImportTraceWizard_HaveToCreateLinksUnderAVirtualFolder
);
675 setErrorMessage(null);
680 protected void restoreWidgetValues() {
681 super.restoreWidgetValues();
683 IDialogSettings settings
= getDialogSettings();
685 if (settings
.get(IMPORT_WIZARD_IMPORT_UNRECOGNIZED_ID
) == null) {
688 value
= settings
.getBoolean(IMPORT_WIZARD_IMPORT_UNRECOGNIZED_ID
);
690 fImportUnrecognizedButton
.setSelection(value
);
692 if (settings
.get(IMPORT_WIZARD_PRESERVE_FOLDERS_ID
) == null) {
695 value
= settings
.getBoolean(IMPORT_WIZARD_PRESERVE_FOLDERS_ID
);
697 fPreserveFolderStructureButton
.setSelection(value
);
699 String
[] directoryNames
= settings
.getArray(IMPORT_WIZARD_ROOT_DIRECTORY_ID
);
700 if ((directoryNames
!= null) && (directoryNames
.length
!= 0)) {
701 for (int i
= 0; i
< directoryNames
.length
; i
++) {
702 directoryNameField
.add(directoryNames
[i
]);
708 protected void saveWidgetValues() {
709 // Persist dialog settings
710 IDialogSettings settings
= getDialogSettings();
711 settings
.put(IMPORT_WIZARD_IMPORT_UNRECOGNIZED_ID
, fImportUnrecognizedButton
.getSelection());
712 settings
.put(IMPORT_WIZARD_PRESERVE_FOLDERS_ID
, fPreserveFolderStructureButton
.getSelection());
714 // update directory names history
715 String
[] directoryNames
= settings
.getArray(IMPORT_WIZARD_ROOT_DIRECTORY_ID
);
716 if (directoryNames
== null) {
717 directoryNames
= new String
[0];
720 String items
[] = directoryNameField
.getItems();
721 for (int i
= 0; i
< items
.length
; i
++) {
722 directoryNames
= addToHistory(directoryNames
, items
[i
]);
724 settings
.put(IMPORT_WIZARD_ROOT_DIRECTORY_ID
, directoryNames
);
727 // ------------------------------------------------------------------------
728 // Import the trace(s)
729 // ------------------------------------------------------------------------
734 * @return <code>true</code> if successful else <code>false</code>
736 public boolean finish() {
737 String traceTypeName
= fTraceTypes
.getText();
738 String traceId
= null;
739 if (!AUTO_DETECT
.equals(traceTypeName
)) {
740 String tokens
[] = traceTypeName
.split(SEPARATOR
, 2);
741 if (tokens
.length
< 2) {
744 traceId
= TmfTraceType
.getInstance().getTraceTypeId(tokens
[0], tokens
[1]);
747 // Save dialog settings
750 IPath baseSourceContainerPath
= new Path(getSourceDirectory().getAbsolutePath());
751 final TraceValidateAndImportOperation operation
= new TraceValidateAndImportOperation(traceId
, baseSourceContainerPath
, getContainerFullPath(),
752 fImportUnrecognizedButton
.getSelection(), fOverwriteExistingResourcesCheckbox
.getSelection(), fCreateLinksInWorkspaceButton
.getSelection(), fPreserveFolderStructureButton
.getSelection());
754 IStatus status
= Status
.OK_STATUS
;
756 getContainer().run(true, true, new IRunnableWithProgress() {
758 public void run(IProgressMonitor monitor
) throws InvocationTargetException
, InterruptedException
{
759 operation
.run(monitor
);
764 status
= operation
.getStatus();
765 } catch (InvocationTargetException e
) {
766 status
= new Status(IStatus
.ERROR
, Activator
.PLUGIN_ID
, Messages
.ImportTraceWizard_ImportProblem
, e
);
767 } catch (InterruptedException e
) {
768 status
= Status
.CANCEL_STATUS
;
770 if (!status
.isOK()) {
771 if (status
.getSeverity() == IStatus
.CANCEL
) {
772 setMessage(Messages
.ImportTraceWizard_ImportOperationCancelled
);
773 setErrorMessage(null);
775 if (status
.getException() != null) {
776 displayErrorDialog(status
.getMessage() + ": " + status
.getException()); //$NON-NLS-1$
779 setErrorMessage(Messages
.ImportTraceWizard_ImportProblem
);
784 setErrorMessage(null);
789 // ------------------------------------------------------------------------
791 // ------------------------------------------------------------------------
793 private class TraceValidateAndImportOperation
{
794 private IStatus fStatus
;
795 private String fTraceType
;
796 private IPath fDestinationContainerPath
;
797 private IPath fBaseSourceContainerPath
;
798 private boolean fImportUnrecognizedTraces
;
799 private boolean fLink
;
800 private boolean fPreserveFolderStructure
;
801 private ImportConfirmation fConfirmationMode
= ImportConfirmation
.SKIP
;
803 private TraceValidateAndImportOperation(String traceId
, IPath baseSourceContainerPath
, IPath destinationContainerPath
, boolean doImport
, boolean overwrite
, boolean link
, boolean preserveFolderStructure
) {
804 fTraceType
= traceId
;
805 fBaseSourceContainerPath
= baseSourceContainerPath
;
806 fDestinationContainerPath
= destinationContainerPath
;
807 fImportUnrecognizedTraces
= doImport
;
809 fConfirmationMode
= ImportConfirmation
.OVERWRITE_ALL
;
812 fPreserveFolderStructure
= preserveFolderStructure
;
815 public void run(IProgressMonitor progressMonitor
) {
816 String currentPath
= null;
817 final Map
<String
, TraceFileSystemElement
> folderElements
= new HashMap
<>();
820 final ArrayList
<TraceFileSystemElement
> fileSystemElements
= new ArrayList
<>();
821 IElementFilter passThroughFilter
= new IElementFilter() {
824 public void filterElements(Collection elements
, IProgressMonitor monitor
) {
825 fileSystemElements
.addAll(elements
);
828 public void filterElements(Object
[] elements
, IProgressMonitor monitor
) {
829 for (int i
= 0; i
< elements
.length
; i
++) {
830 fileSystemElements
.add((TraceFileSystemElement
)elements
[i
]);
835 // List fileSystemElements will be filled using the passThroughFilter
836 SubMonitor subMonitor
= SubMonitor
.convert(progressMonitor
, 1);
837 fSelectionGroup
.getAllCheckedListItems(passThroughFilter
, subMonitor
);
839 // Check if operation was cancelled.
840 ModalContext
.checkCanceled(subMonitor
);
842 Iterator
<TraceFileSystemElement
> fileSystemElementsIter
= fileSystemElements
.iterator();
843 subMonitor
= SubMonitor
.convert(progressMonitor
, fileSystemElements
.size());
845 while (fileSystemElementsIter
.hasNext()) {
846 ModalContext
.checkCanceled(progressMonitor
);
848 TraceFileSystemElement element
= fileSystemElementsIter
.next();
849 File fileResource
= (File
) element
.getFileSystemObject();
850 String resourcePath
= fileResource
.getAbsolutePath();
851 element
.setDestinationContainerPath(computeDestinationContainerPath(new Path(resourcePath
)));
853 currentPath
= resourcePath
;
854 SubMonitor sub
= subMonitor
.newChild(1);
855 if (element
.isDirectory()) {
856 if (!folderElements
.containsKey(resourcePath
)) {
857 if (isDirectoryTrace(element
)) {
858 folderElements
.put(resourcePath
, element
);
859 validateAndImportTrace(element
, sub
);
863 TraceFileSystemElement parentElement
= (TraceFileSystemElement
)element
.getParent();
864 File parentFile
= (File
) parentElement
.getFileSystemObject();
865 String parentPath
= parentFile
.getAbsolutePath();
866 parentElement
.setDestinationContainerPath(computeDestinationContainerPath(new Path(parentPath
)));
867 currentPath
= parentPath
;
868 if (!folderElements
.containsKey(parentPath
)) {
869 if (isDirectoryTrace(parentElement
)) {
870 folderElements
.put(parentPath
, parentElement
);
871 validateAndImportTrace(parentElement
, sub
);
873 if (fileResource
.exists()) {
874 validateAndImportTrace(element
, sub
);
880 setStatus(Status
.OK_STATUS
);
881 } catch (InterruptedException e
) {
882 setStatus(Status
.CANCEL_STATUS
);
883 } catch (Exception e
) {
884 String errorMessage
= Messages
.ImportTraceWizard_ImportProblem
+ ": " + //$NON-NLS-1$
885 (currentPath
!= null ? currentPath
: ""); //$NON-NLS-1$
886 Activator
.getDefault().logError(errorMessage
, e
);
887 setStatus(new Status(IStatus
.ERROR
, Activator
.PLUGIN_ID
, errorMessage
, e
));
891 private IPath
computeDestinationContainerPath(Path resourcePath
) {
892 IPath destinationContainerPath
= fDestinationContainerPath
;
894 // We need to figure out the new destination path relative to the selected "base" source directory.
895 // Here for example, the selected source directory is /home/user
896 if (fPreserveFolderStructure
) {
897 // /home/user/bar/foo/trace -> /home/user/bar/foo
898 IPath sourceContainerPath
= resourcePath
.removeLastSegments(1);
899 if (fBaseSourceContainerPath
.equals(resourcePath
)) {
900 // Use resourcePath directory if fBaseSourceContainerPath points to a directory trace
901 sourceContainerPath
= resourcePath
;
903 // /home/user/bar/foo, /home/user -> bar/foo
904 IPath relativeContainerPath
= sourceContainerPath
.makeRelativeTo(fBaseSourceContainerPath
);
905 // project/Traces + bar/foo -> project/Traces/bar/foo
906 destinationContainerPath
= fDestinationContainerPath
.append(relativeContainerPath
);
908 return destinationContainerPath
;
911 private void validateAndImportTrace(TraceFileSystemElement fileSystemElement
, IProgressMonitor monitor
)
912 throws TmfTraceImportException
, CoreException
, InvocationTargetException
, InterruptedException
{
913 File file
= (File
) fileSystemElement
.getFileSystemObject();
914 String path
= file
.getAbsolutePath();
915 TraceTypeHelper traceTypeHelper
= null;
917 if (fTraceType
== null) {
920 traceTypeHelper
= TmfTraceTypeUIUtils
.selectTraceType(path
, null, null);
921 } catch (TmfTraceImportException e
) {
922 // the trace did not match any trace type
924 if (traceTypeHelper
== null) {
925 if (fImportUnrecognizedTraces
) {
926 importResource(fileSystemElement
, monitor
);
931 boolean isDirectoryTraceType
= TmfTraceType
.getInstance().isDirectoryTraceType(fTraceType
);
932 if (fileSystemElement
.isDirectory() != isDirectoryTraceType
) {
935 traceTypeHelper
= TmfTraceType
.getInstance().getTraceType(fTraceType
);
937 if (traceTypeHelper
== null) {
938 // Trace type not found
939 throw new TmfTraceImportException(Messages
.ImportTraceWizard_TraceTypeNotFound
);
942 if (!traceTypeHelper
.validate(path
).isOK()) {
943 // Trace type exist but doesn't validate for given trace.
948 // Finally import trace
949 IResource importedResource
= importResource(fileSystemElement
, monitor
);
950 if (importedResource
!= null) {
951 TmfTraceTypeUIUtils
.setTraceType(importedResource
, traceTypeHelper
);
957 * Imports a trace resource to project. In case of name collision the
958 * user will be asked to confirm overwriting the existing trace,
959 * overwriting or skipping the trace to be imported.
961 * @param fileSystemElement
962 * trace file system object to import
965 * @return the imported resource or null if no resource was imported
967 * @throws InvocationTargetException
968 * if problems during import operation
969 * @throws InterruptedException
971 * @throws CoreException
972 * if problems with workspace
974 private IResource
importResource(TraceFileSystemElement fileSystemElement
, IProgressMonitor monitor
)
975 throws InvocationTargetException
, InterruptedException
, CoreException
{
977 ImportConfirmation mode
= checkForNameClashes(fileSystemElement
);
981 rename(fileSystemElement
);
985 delete(fileSystemElement
, monitor
);
995 List
<TraceFileSystemElement
> subList
= new ArrayList
<>();
997 FileSystemElement parentFolder
= fileSystemElement
.getParent();
999 IPath containerPath
= fileSystemElement
.getDestinationContainerPath();
1000 IPath tracePath
= containerPath
.addTrailingSeparator().append(fileSystemElement
.getLabel());
1001 if (fileSystemElement
.isDirectory() && (!fLink
)) {
1002 containerPath
= tracePath
;
1004 Object
[] array
= fileSystemElement
.getFiles().getChildren();
1005 for (int i
= 0; i
< array
.length
; i
++) {
1006 subList
.add((TraceFileSystemElement
)array
[i
]);
1008 parentFolder
= fileSystemElement
;
1011 subList
.add(fileSystemElement
);
1015 ImportProvider fileSystemStructureProvider
= new ImportProvider();
1017 IOverwriteQuery myQueryImpl
= new IOverwriteQuery() {
1019 public String
queryOverwrite(String file
) {
1020 return IOverwriteQuery
.NO_ALL
;
1024 monitor
.setTaskName(Messages
.ImportTraceWizard_ImportOperationTaskName
+ " " + ((File
)fileSystemElement
.getFileSystemObject()).getAbsolutePath()); //$NON-NLS-1$
1025 ImportOperation operation
= new ImportOperation(containerPath
, parentFolder
, fileSystemStructureProvider
, myQueryImpl
, subList
);
1026 operation
.setContext(getShell());
1028 operation
.setCreateContainerStructure(false);
1029 operation
.setOverwriteResources(false);
1030 operation
.setCreateLinks(fLink
);
1031 operation
.setVirtualFolders(false);
1033 operation
.run(new SubProgressMonitor(monitor
, 1, SubProgressMonitor
.PREPEND_MAIN_LABEL_TO_SUBTASK
));
1035 File file
= (File
) fileSystemElement
.getFileSystemObject();
1036 String sourceLocation
= null;
1037 IResource sourceResource
;
1038 if (file
.isDirectory()) {
1039 sourceResource
= ResourcesPlugin
.getWorkspace().getRoot().getContainerForLocation(Path
.fromOSString(file
.getAbsolutePath()));
1041 sourceResource
= ResourcesPlugin
.getWorkspace().getRoot().getFileForLocation(Path
.fromOSString(file
.getAbsolutePath()));
1043 if (sourceResource
!= null && sourceResource
.exists()) {
1044 sourceLocation
= sourceResource
.getPersistentProperty(TmfCommonConstants
.SOURCE_LOCATION
);
1046 if (sourceLocation
== null) {
1047 sourceLocation
= URIUtil
.toUnencodedString(file
.toURI());
1050 IResource resource
= ResourcesPlugin
.getWorkspace().getRoot().findMember(tracePath
);
1051 resource
.setPersistentProperty(TmfCommonConstants
.SOURCE_LOCATION
, sourceLocation
);
1056 private boolean isDirectoryTrace(FileSystemElement fileSystemElement
) {
1057 File file
= (File
) fileSystemElement
.getFileSystemObject();
1058 String path
= file
.getAbsolutePath();
1059 if (TmfTraceType
.getInstance().isDirectoryTrace(path
)) {
1065 private ImportConfirmation
checkForNameClashes(TraceFileSystemElement fileSystemElement
) throws InterruptedException
{
1066 IPath tracePath
= getInitialDestinationPath(fileSystemElement
);
1069 if (getExistingTrace(tracePath
) != null) {
1070 if ((fConfirmationMode
== ImportConfirmation
.RENAME_ALL
) ||
1071 (fConfirmationMode
== ImportConfirmation
.OVERWRITE_ALL
) ||
1072 (fConfirmationMode
== ImportConfirmation
.SKIP_ALL
)) {
1073 return fConfirmationMode
;
1076 int returnCode
= promptForOverwrite(tracePath
);
1077 if (returnCode
< 0) {
1079 throw new InterruptedException();
1081 fConfirmationMode
= ImportConfirmation
.values()[returnCode
];
1082 return fConfirmationMode
;
1084 return ImportConfirmation
.CONTINUE
;
1087 private int promptForOverwrite(IPath tracePath
) {
1088 final MessageDialog dialog
= new MessageDialog(getContainer()
1089 .getShell(), null, null, NLS
.bind(Messages
.ImportTraceWizard_TraceAlreadyExists
, tracePath
.makeRelativeTo(fTraceFolderElement
.getProject().getPath())),
1090 MessageDialog
.QUESTION
, new String
[] {
1091 ImportConfirmation
.RENAME
.getInName(),
1092 ImportConfirmation
.RENAME_ALL
.getInName(),
1093 ImportConfirmation
.OVERWRITE
.getInName(),
1094 ImportConfirmation
.OVERWRITE_ALL
.getInName(),
1095 ImportConfirmation
.SKIP
.getInName(),
1096 ImportConfirmation
.SKIP_ALL
.getInName(),
1099 protected int getShellStyle() {
1100 return super.getShellStyle() | SWT
.SHEET
;
1104 final int[] returnValue
= new int[1];
1105 getShell().getDisplay().syncExec(new Runnable() {
1109 returnValue
[0] = dialog
.open();
1112 return returnValue
[0];
1116 * @return the initial destination path, before rename, if any
1118 private IPath
getInitialDestinationPath(TraceFileSystemElement fileSystemElement
) {
1119 IPath traceFolderPath
= fileSystemElement
.getDestinationContainerPath();
1120 return traceFolderPath
.append(((File
)fileSystemElement
.getFileSystemObject()).getName());
1123 private void rename(TraceFileSystemElement fileSystemElement
) {
1124 IPath tracePath
= getInitialDestinationPath(fileSystemElement
);
1125 TmfTraceElement trace
= getExistingTrace(tracePath
);
1126 if (trace
== null) {
1130 // Not using IFolder on purpose to leave the door open to import directly into an IProject
1131 IContainer folder
= (IContainer
) trace
.getParent().getResource();
1134 String name
= trace
.getName() + '(' + Integer
.toString(i
++) + ')';
1135 IResource resource
= folder
.findMember(name
);
1136 if (resource
== null) {
1137 fileSystemElement
.setLabel(name
);
1143 private void delete(TraceFileSystemElement fileSystemElement
, IProgressMonitor monitor
) throws CoreException
{
1144 IPath tracePath
= getInitialDestinationPath(fileSystemElement
);
1145 TmfTraceElement trace
= getExistingTrace(tracePath
);
1146 if (trace
== null) {
1150 trace
.delete(monitor
);
1153 private TmfTraceElement
getExistingTrace(IPath tracePath
) {
1154 List
<TmfTraceElement
> traces
= fTraceFolderElement
.getTraces();
1155 for (TmfTraceElement t
: traces
) {
1156 if (t
.getPath().equals(tracePath
)) {
1164 * Set the status for this operation
1169 protected void setStatus(IStatus status
) {
1173 public IStatus
getStatus() {
1179 * The <code>TraceFileSystemElement</code> is a <code>FileSystemElement</code> that knows
1180 * if it has been populated or not.
1182 private static class TraceFileSystemElement
extends FileSystemElement
{
1184 private boolean fIsPopulated
= false;
1185 private String fLabel
= null;
1186 private IPath fDestinationContainerPath
;
1188 public TraceFileSystemElement(String name
, FileSystemElement parent
, boolean isDirectory
) {
1189 super(name
, parent
, isDirectory
);
1192 public void setDestinationContainerPath(IPath destinationContainerPath
) {
1193 fDestinationContainerPath
= destinationContainerPath
;
1196 public void setPopulated() {
1197 fIsPopulated
= true;
1200 public boolean isPopulated() {
1201 return fIsPopulated
;
1205 public AdaptableList
getFiles() {
1207 populateElementChildren();
1209 return super.getFiles();
1213 public AdaptableList
getFolders() {
1215 populateElementChildren();
1217 return super.getFolders();
1221 * Sets the label for the trace to be used when importing at trace.
1223 * the label for the trace
1225 public void setLabel(String name
) {
1230 * Returns the label for the trace to be used when importing at trace.
1232 * @return the label of trace resource
1234 public String
getLabel() {
1235 if (fLabel
== null) {
1236 //Get the name - if it is empty then return the path as it is a file root
1237 File file
= (File
) getFileSystemObject();
1238 String name
= file
.getName();
1239 if (name
.length() == 0) {
1240 return file
.getPath();
1248 * The full path to the container that will contain the trace
1250 * @return the destination container path
1252 public IPath
getDestinationContainerPath() {
1253 return fDestinationContainerPath
;
1257 * Populates the children of the specified parent <code>FileSystemElement</code>
1259 private void populateElementChildren() {
1260 FileSystemStructureProvider provider
= FileSystemStructureProvider
.INSTANCE
;
1261 List
<File
> allchildren
= provider
.getChildren(this.getFileSystemObject());
1263 TraceFileSystemElement newelement
= null;
1264 Iterator
<File
> iter
= allchildren
.iterator();
1265 while(iter
.hasNext()) {
1266 child
= iter
.next();
1267 newelement
= new TraceFileSystemElement(provider
.getLabel(child
), this, provider
.isFolder(child
));
1268 newelement
.setFileSystemObject(child
);
1274 private class ImportProvider
implements IImportStructureProvider
{
1276 private FileSystemStructureProvider provider
= FileSystemStructureProvider
.INSTANCE
;
1282 public String
getLabel(Object element
) {
1283 TraceFileSystemElement resource
= (TraceFileSystemElement
)element
;
1284 return resource
.getLabel();
1288 public List
getChildren(Object element
) {
1289 TraceFileSystemElement resource
= (TraceFileSystemElement
)element
;
1290 Object
[] array
= resource
.getFiles().getChildren();
1291 List
<Object
> list
= new ArrayList
<>();
1292 for (int i
= 0; i
< array
.length
; i
++) {
1299 public InputStream
getContents(Object element
) {
1300 TraceFileSystemElement resource
= (TraceFileSystemElement
)element
;
1301 return provider
.getContents(resource
.getFileSystemObject());
1305 public String
getFullPath(Object element
) {
1306 TraceFileSystemElement resource
= (TraceFileSystemElement
)element
;
1307 return provider
.getFullPath(resource
.getFileSystemObject());
1311 public boolean isFolder(Object element
) {
1312 TraceFileSystemElement resource
= (TraceFileSystemElement
)element
;
1313 return resource
.isDirectory();
1317 private enum ImportConfirmation
{
1318 // ------------------------------------------------------------------------
1320 // ------------------------------------------------------------------------
1321 RENAME(Messages
.ImportTraceWizard_ImportConfigurationRename
),
1322 RENAME_ALL(Messages
.ImportTraceWizard_ImportConfigurationRenameAll
),
1323 OVERWRITE(Messages
.ImportTraceWizard_ImportConfigurationOverwrite
),
1324 OVERWRITE_ALL(Messages
.ImportTraceWizard_ImportConfigurationOverwriteAll
),
1325 SKIP(Messages
.ImportTraceWizard_ImportConfigurationSkip
),
1326 SKIP_ALL(Messages
.ImportTraceWizard_ImportConfigurationSkipAll
),
1327 CONTINUE("CONTINUE"); //$NON-NLS-1$
1329 // ------------------------------------------------------------------------
1331 // ------------------------------------------------------------------------
1335 private final String fInName
;
1337 // ------------------------------------------------------------------------
1339 // ------------------------------------------------------------------------
1342 * Private constructor
1343 * @param name the name of state
1345 private ImportConfirmation(String name
) {
1349 // ------------------------------------------------------------------------
1351 // ------------------------------------------------------------------------
1353 * @return state name
1355 public String
getInName() {