control: Import as experiment only when checkbox is enabled
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.remote.ui / src / org / eclipse / tracecompass / internal / tmf / remote / ui / wizards / fetch / RemoteFetchLogWizardRemotePage.java
1 /*******************************************************************************
2 * Copyright (c) 2016 Ericsson
3 *
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
8 *
9 * Contributors:
10 * Marc-Andre Laperle - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch;
14
15 import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
16
17 import java.lang.reflect.InvocationTargetException;
18 import java.text.MessageFormat;
19 import java.util.ArrayList;
20 import java.util.HashSet;
21 import java.util.List;
22 import java.util.Set;
23
24 import org.eclipse.core.resources.IFolder;
25 import org.eclipse.core.resources.IProject;
26 import org.eclipse.core.resources.IResource;
27 import org.eclipse.core.resources.IWorkspace;
28 import org.eclipse.core.resources.ResourcesPlugin;
29 import org.eclipse.core.runtime.CoreException;
30 import org.eclipse.core.runtime.IProgressMonitor;
31 import org.eclipse.core.runtime.IStatus;
32 import org.eclipse.core.runtime.Status;
33 import org.eclipse.core.runtime.SubMonitor;
34 import org.eclipse.jdt.annotation.Nullable;
35 import org.eclipse.jface.operation.IRunnableWithProgress;
36 import org.eclipse.jface.viewers.CheckboxTreeViewer;
37 import org.eclipse.jface.viewers.IStructuredSelection;
38 import org.eclipse.jface.viewers.ViewerComparator;
39 import org.eclipse.osgi.util.NLS;
40 import org.eclipse.swt.SWT;
41 import org.eclipse.swt.custom.CCombo;
42 import org.eclipse.swt.events.ModifyEvent;
43 import org.eclipse.swt.events.ModifyListener;
44 import org.eclipse.swt.events.SelectionAdapter;
45 import org.eclipse.swt.events.SelectionEvent;
46 import org.eclipse.swt.graphics.Image;
47 import org.eclipse.swt.layout.GridData;
48 import org.eclipse.swt.layout.GridLayout;
49 import org.eclipse.swt.widgets.Button;
50 import org.eclipse.swt.widgets.Composite;
51 import org.eclipse.swt.widgets.Group;
52 import org.eclipse.swt.widgets.Text;
53 import org.eclipse.swt.widgets.ToolBar;
54 import org.eclipse.swt.widgets.ToolItem;
55 import org.eclipse.tracecompass.internal.tmf.remote.ui.Activator;
56 import org.eclipse.tracecompass.internal.tmf.remote.ui.messages.RemoteMessages;
57 import org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteGenerateManifestOperation;
58 import org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportConnectionNodeElement;
59 import org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportProfileElement;
60 import org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportTracesOperation;
61 import org.eclipse.tracecompass.internal.tmf.ui.project.operations.NewExperimentOperation;
62 import org.eclipse.tracecompass.internal.tmf.ui.project.operations.SelectTracesOperation;
63 import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.AbstractTracePackageOperation;
64 import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.AbstractTracePackageWizardPage;
65 import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.TracePackageElement;
66 import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.TracePackageFilesElement;
67 import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.TracePackageLabelProvider;
68 import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.TracePackageTraceElement;
69 import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.importexport.Messages;
70 import org.eclipse.tracecompass.tmf.core.TmfProjectNature;
71 import org.eclipse.tracecompass.tmf.ui.project.model.TmfExperimentElement;
72 import org.eclipse.tracecompass.tmf.ui.project.model.TmfExperimentFolder;
73 import org.eclipse.tracecompass.tmf.ui.project.model.TmfProjectElement;
74 import org.eclipse.tracecompass.tmf.ui.project.model.TmfProjectRegistry;
75 import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceFolder;
76 import org.eclipse.tracecompass.tmf.ui.project.model.TmfTracesFolder;
77 import org.eclipse.tracecompass.tmf.ui.project.model.TraceUtils;
78 import org.eclipse.ui.ISharedImages;
79 import org.eclipse.ui.PlatformUI;
80 import org.eclipse.ui.plugin.AbstractUIPlugin;
81
82 /**
83 * Wizard page that connects to a remote node, lists all traces according to
84 * a given remote profile and imports the selected traces.
85
86 * @author Marc-Andre Laperle
87 * @author Bernd Hufmann
88 */
89 public class RemoteFetchLogWizardRemotePage extends AbstractTracePackageWizardPage {
90
91 // ------------------------------------------------------------------------
92 // Constant(s)
93 // ------------------------------------------------------------------------
94 /* The page name */
95 private static final String PAGE_NAME = "org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch"; //$NON-NLS-1$
96 private static final String ICON_PATH = "icons/elcl16/fetch_log_wiz.gif"; //$NON-NLS-1$
97 private static final Image COLLAPSE_ALL_IMAGE = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_ELCL_COLLAPSEALL);
98 private static final Image EXPAND_ALL_IMAGE = Activator.getDefault().getImageFromPath("icons/elcl16/expandall.png"); //$NON-NLS-1$
99 /** Name of default project to import traces to */
100 public static final String DEFAULT_REMOTE_PROJECT_NAME = "Remote"; //$NON-NLS-1$
101
102 // ------------------------------------------------------------------------
103 // Attributes(s)
104 // ------------------------------------------------------------------------
105 private TmfTraceFolder fTmfTraceFolder;
106
107 private RemoteImportProfileElement fProfile;
108 private final Set<RemoteImportConnectionNodeElement> fRemoteHosts = new HashSet<>();
109 private boolean fOverwriteAll;
110 private boolean fIsVisible = false;
111 private String fDefaultProjectName = null;
112 private CCombo fCombo;
113 private Button fCreateExperimentCheckbox;
114 private Text fExperimentNameText;
115 private List<IProject> fProjects;
116 private @Nullable TmfExperimentFolder fExperimentFolderElement;
117 private @Nullable String fExperimentName;
118
119 // ------------------------------------------------------------------------
120 // Constructors
121 // ------------------------------------------------------------------------
122 /**
123 * Constructor
124 *
125 * @param title
126 * The Wizard title
127 * @param selection
128 * The current selection (trace folder element)
129 * @param profile
130 * A profile to use or null
131 * @param experimentName
132 * A name of an experiment to create and add traces to, or null
133 * for no experiment
134 */
135 protected RemoteFetchLogWizardRemotePage(String title, IStructuredSelection selection, @Nullable RemoteImportProfileElement profile, @Nullable String experimentName) {
136 super(PAGE_NAME, title, null, selection);
137 setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, ICON_PATH));
138
139 if (selection.getFirstElement() instanceof TmfTraceFolder) {
140 fTmfTraceFolder = (TmfTraceFolder) selection.getFirstElement();
141 }
142
143 if (fTmfTraceFolder == null) {
144 // create default project
145 TmfProjectRegistry.createProject(DEFAULT_REMOTE_PROJECT_NAME, null, null);
146 fDefaultProjectName = DEFAULT_REMOTE_PROJECT_NAME;
147 }
148
149 fProfile = profile;
150 fExperimentName = experimentName;
151 setDescription(RemoteMessages.RemoteFetchLogWizardRemotePage_Description);
152 }
153
154 // ------------------------------------------------------------------------
155 // Operations
156 // ------------------------------------------------------------------------
157 @Override
158 public void createControl(Composite parent) {
159 initializeDialogUnits(parent);
160
161 Composite composite = new Composite(parent, SWT.NULL);
162 composite.setLayout(new GridLayout());
163 composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL
164 | GridData.HORIZONTAL_ALIGN_FILL));
165 composite.setFont(parent.getFont());
166
167 createToolBar(composite);
168 createElementViewer(composite);
169
170 createButtonsGroup(composite);
171
172 createProjectGroup(composite);
173
174 createOptionGroup(composite);
175
176 restoreWidgetValues();
177 updatePageCompletion();
178
179 setControl(composite);
180 }
181
182 @Override
183 protected boolean determinePageCompletion() {
184 if (getElementViewer().getCheckedElements().length <= 0) {
185 return false;
186 }
187
188 validateProject();
189
190 if ((fExperimentName != null) && (fCreateExperimentCheckbox.getSelection())) {
191 String name = fExperimentNameText.getText().trim();
192 // verify if experiment name is empty
193 if (name.isEmpty()) {
194 setMessage(null);
195 setErrorMessage(RemoteMessages.RemoteFetchLogWizardRemotePage_ErrorEmptyExperimentName);
196 return false;
197 }
198
199 // verify that name is a valid resource name
200 IWorkspace workspace = ResourcesPlugin.getWorkspace();
201 if ((workspace != null) && (!workspace.validateName(name, IResource.FILE).isOK())) {
202 setMessage(null);
203 setErrorMessage(NLS.bind(RemoteMessages.RemoteFetchLogWizardRemotePage_ErrorExperimentNameInvalid, name));
204 return false;
205 }
206
207 TmfExperimentFolder experimentFolder = fExperimentFolderElement;
208 if (experimentFolder != null) {
209 TmfExperimentElement element =
210 experimentFolder.getExperiment(name);
211 // verify if experiment already exists
212 if (element != null) {
213 setMessage(null);
214 setErrorMessage(NLS.bind(RemoteMessages.RemoteFetchLogWizardRemotePage_ErrorExperimentAlreadyExists, name));
215 return false;
216 }
217
218 // verify if a resource already exists in the experiment folder
219 IFolder expResource = experimentFolder.getResource();
220 IResource res = expResource.findMember(name);
221 if (res != null) {
222 setMessage(null);
223 setErrorMessage(NLS.bind(RemoteMessages.RemoteFetchLogWizardRemotePage_ErrorResourceAlreadyExists, name));
224 return false;
225 }
226 }
227 }
228
229 return true;
230
231 }
232
233 @Override
234 protected void updateWithFilePathSelection() {
235 }
236
237 @Override
238 public void setVisible(final boolean visible) {
239 super.setVisible(visible);
240
241 fIsVisible = visible;
242
243 if (visible) {
244 getContainer().getShell().getDisplay().asyncExec(new Runnable() {
245 @Override
246 public void run() {
247 updateViewer();
248 }
249 });
250 } else {
251 getElementViewer().setInput(null);
252 }
253 }
254
255 private void createToolBar(Composite parent) {
256 ToolBar toolBar = new ToolBar(parent, SWT.HORIZONTAL);
257 toolBar.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
258
259 ToolItem expandAll = new ToolItem(toolBar, SWT.PUSH);
260 expandAll.setImage(EXPAND_ALL_IMAGE);
261 expandAll.setToolTipText(RemoteMessages.RemoteFetchLogWizardRemotePage_ExpandAll);
262 expandAll.addSelectionListener(new SelectionAdapter() {
263 @Override
264 public void widgetSelected(SelectionEvent e) {
265 getElementViewer().expandAll();
266 }
267 });
268
269 ToolItem collapseAll = new ToolItem(toolBar, SWT.PUSH);
270 collapseAll.setImage(COLLAPSE_ALL_IMAGE);
271 collapseAll.setToolTipText(RemoteMessages.RemoteFetchLogWizardRemotePage_CollapseAll);
272 collapseAll.addSelectionListener(new SelectionAdapter() {
273 @Override
274 public void widgetSelected(SelectionEvent e) {
275 getElementViewer().collapseAll();
276 }
277 });
278 }
279
280 @Override
281 protected void createElementViewer(Composite compositeParent) {
282 super.createElementViewer(compositeParent);
283
284 CheckboxTreeViewer elementViewer = getElementViewer();
285 elementViewer.setLabelProvider(new TracePackageLabelProvider() {
286 @Override
287 public String getText(Object element) {
288 if (element instanceof TracePackageTraceElement) {
289 for (TracePackageElement files : ((TracePackageTraceElement) element).getChildren()) {
290 if (files instanceof TracePackageFilesElement) {
291 return ((TracePackageFilesElement) files).getFileName();
292 }
293 }
294 }
295 return super.getText(element);
296 }
297 @Override
298 public Image getImage(Object element) {
299 if (element instanceof TracePackageTraceElement) {
300 for (TracePackageElement files : ((TracePackageTraceElement) element).getChildren()) {
301 return files.getImage();
302 }
303 }
304 return super.getImage(element);
305 }
306 });
307 elementViewer.setComparator(new ViewerComparator() {
308 @Override
309 public int category(Object element) {
310 if (element instanceof TracePackageTraceElement) {
311 return 1;
312 }
313 return 0;
314 }
315 });
316 }
317
318 private void createProjectGroup(Composite parent) {
319 if (fDefaultProjectName != null) {
320 Group projectGroup = new Group(parent, SWT.SHADOW_NONE);
321 projectGroup.setText(RemoteMessages.RemoteFetchLogWizardRemotePage_ImportDialogProjectsGroupName);
322 GridLayout layout = new GridLayout(1, true);
323 projectGroup.setLayout(layout);
324 projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
325
326 fProjects = new ArrayList<>();
327 List<String> projectNames = new ArrayList<>();
328
329 for (IProject project : TraceUtils.getOpenedTmfProjects()) {
330 fProjects.add(project);
331 projectNames.add(project.getName());
332 }
333
334 fCombo = new CCombo(projectGroup, SWT.READ_ONLY);
335 fCombo.setToolTipText(RemoteMessages.RemoteFetchLogWizardRemotePage_ImportDialogProjectsGroupName);
336 fCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1));
337 fCombo.setItems(projectNames.toArray(new String[projectNames.size()]));
338 int select = projectNames.indexOf(fDefaultProjectName);
339 fCombo.select(select);
340 }
341 }
342
343 private void createOptionGroup(Composite parent) {
344 if (fExperimentName != null) {
345 Group comp = new Group(parent, SWT.SHADOW_NONE);
346 comp.setText(RemoteMessages.RemoteFetchLogWizardRemotePage_OptionsGroupName);
347 GridLayout layout = new GridLayout(2, false);
348 comp.setLayout(layout);
349 GridData data = new GridData(GridData.FILL, GridData.CENTER, true, false);
350 comp.setLayoutData(data);
351
352 fCreateExperimentCheckbox = new Button(comp, SWT.CHECK);
353 fCreateExperimentCheckbox.setFont(comp.getFont());
354 fCreateExperimentCheckbox.setText(RemoteMessages.RemoteFetchLogWizardRemotePage_CreateExperimentName);
355 fCreateExperimentCheckbox.setSelection(false);
356 data = new GridData(GridData.BEGINNING, GridData.CENTER, false, false);
357 fCreateExperimentCheckbox.setLayoutData(data);
358
359 fExperimentNameText = new Text(comp, SWT.BORDER);
360 data = new GridData(GridData.FILL, GridData.CENTER, true, false);
361 fExperimentNameText.setLayoutData(data);
362 fExperimentNameText.setText(fExperimentName);
363 fExperimentNameText.setEnabled(fCreateExperimentCheckbox.getSelection());
364
365 fExperimentNameText.addModifyListener(new ModifyListener() {
366 @Override
367 public void modifyText(ModifyEvent e) {
368 updatePageCompletion();
369 }
370 });
371
372 fCreateExperimentCheckbox.addSelectionListener(new SelectionAdapter() {
373 @Override
374 public void widgetSelected(SelectionEvent e) {
375 fExperimentNameText.setEnabled(fCreateExperimentCheckbox.getSelection());
376 updatePageCompletion();
377 }
378 });
379 }
380 }
381
382 @Override
383 protected Object createElementViewerInput() {
384 if (fProfile == null) {
385 return null;
386 }
387 final List<RemoteImportConnectionNodeElement> remoteHosts = fProfile.getConnectionNodeElements();
388
389 if (remoteHosts.size() == 0) {
390 return new Status(IStatus.ERROR, Activator.PLUGIN_ID, RemoteMessages.RemoteFetchLogWizardRemotePage_MissingConnectionInformation);
391 }
392
393 final IStatus status[] = new IStatus[1];
394 try {
395 getContainer().run(true, true, new IRunnableWithProgress() {
396 @Override
397 public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
398 SubMonitor subMonitor = SubMonitor.convert(monitor, remoteHosts.size());
399 for (final RemoteImportConnectionNodeElement remoteHost : remoteHosts) {
400 SubMonitor child = subMonitor.newChild(1);
401 child.setTaskName(MessageFormat.format(RemoteMessages.RemoteFetchLogWizardRemotePage_OpeningConnectionTo, remoteHost.getURI()));
402 status[0] = remoteHost.connect(checkNotNull(subMonitor.newChild(1)));
403 if (!status[0].isOK()) {
404 monitor.done();
405 return;
406 }
407 // cache remote host
408 fRemoteHosts.add(remoteHost);
409 }
410 monitor.done();
411 }
412 });
413 } catch (InvocationTargetException e) {
414 handleError(
415 MessageFormat.format(RemoteMessages.RemoteFetchLogWizardRemotePage_ConnectionError, fProfile.getText()),
416 e);
417 return null;
418 } catch (InterruptedException e) {
419 // Cancelled
420 status[0] = Status.CANCEL_STATUS;
421 }
422
423 if (!status[0].isOK()) {
424 handleErrorStatus(status[0]);
425 return null;
426 }
427
428 try {
429 final AbstractTracePackageOperation generateManifestOperation = new RemoteGenerateManifestOperation(fProfile);
430
431 getContainer().run(true, true, new IRunnableWithProgress() {
432 @Override
433 public void run(IProgressMonitor monitor)
434 throws InvocationTargetException, InterruptedException {
435 monitor.beginTask(
436 Messages.ImportTracePackageWizardPage_ReadingPackage,
437 10);
438 generateManifestOperation.run(monitor);
439 monitor.done();
440 }
441 });
442
443 status[0] = generateManifestOperation.getStatus();
444 if (status[0].getSeverity() == IStatus.ERROR) {
445 handleErrorStatus(status[0]);
446 return null;
447 }
448 return generateManifestOperation.getResultElements();
449 } catch (InvocationTargetException e1) {
450 handleError(
451 Messages.TracePackageExtractManifestOperation_ErrorReadingManifest,
452 e1);
453 } catch (InterruptedException e1) {
454 // Canceled
455 }
456 return null;
457 }
458
459 /**
460 * Method to set input data for this wizard
461 *
462 * @param profile
463 * The remote profile
464 * @param overwriteAll
465 * Overwrite existing traces without confirmation
466 */
467 public void setPageData(RemoteImportProfileElement profile, boolean overwriteAll) {
468 fProfile = profile;
469 fOverwriteAll = overwriteAll;
470 }
471
472 /**
473 * Finishes the wizard page.
474 *
475 * @return <code>true</code> if successful else <code>false</code>
476 */
477 public boolean finish() {
478
479 boolean result;
480 if (!fIsVisible) {
481 result = updateViewer();
482 if (!result) {
483 return false;
484 }
485 }
486
487 result = validateProject();
488 if (!result) {
489 return false;
490 }
491
492 Object[] elements = getElementViewer().getCheckedElements();
493 final RemoteImportTracesOperation importOperation = new RemoteImportTracesOperation(getContainer().getShell(), fTmfTraceFolder, elements, fOverwriteAll);
494
495 final List<IResource> traceResources = new ArrayList<>();
496 try {
497 getContainer().run(true, true, new IRunnableWithProgress() {
498 @Override
499 public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
500 importOperation.run(monitor);
501 traceResources.addAll(importOperation.getImportedResources());
502 monitor.done();
503 }
504 });
505
506 if ((fExperimentName != null) && fCreateExperimentCheckbox.getSelection() && (traceResources.size() > 0)) {
507 final IFolder[] experimentFolders = new IFolder[1];
508 final TmfExperimentFolder root = fExperimentFolderElement;
509 final IStatus[] operationStatus = new IStatus[1];
510 final String experimentName = fExperimentNameText.getText().trim();
511
512 // just safety guards
513 if ((root == null) || (experimentName == null)) {
514 return true;
515 }
516 getContainer().run(true, true, new IRunnableWithProgress() {
517 @Override
518 public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
519 operationStatus[0] = null;
520 final NewExperimentOperation operation = new NewExperimentOperation(root, experimentName);
521 operation.run(monitor);
522 monitor.done();
523 operationStatus[0] = operation.getStatus();
524 experimentFolders[0] = operation.getExperimentFolder();
525 }
526 });
527
528 final IFolder expFolder = experimentFolders[0];
529 final TmfTraceFolder parentTraceFolder = fTmfTraceFolder;
530 // just safety guards
531 if ((expFolder == null) || (parentTraceFolder == null)) {
532 return true;
533 }
534
535 if ((operationStatus[0] != null) && (operationStatus[0].isOK())) {
536 getContainer().run(true, true, new IRunnableWithProgress() {
537 @Override
538 public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
539 operationStatus[0] = null;
540 final SelectTracesOperation operation = new SelectTracesOperation(root, expFolder, parentTraceFolder, traceResources);
541 operation.run(monitor);
542 monitor.done();
543 operationStatus[0] = operation.getStatus();
544 }
545 });
546 }
547 }
548 } catch (InvocationTargetException e) {
549 handleError(
550 Messages.TracePackageExtractManifestOperation_ErrorReadingManifest,
551 e);
552 return false;
553 } catch (InterruptedException e) {
554 // Cancelled
555 return false;
556 }
557
558 IStatus status = importOperation.getStatus();
559 if (status.getSeverity() == IStatus.ERROR) {
560 handleErrorStatus(status);
561 return false;
562 }
563
564 disconnectAllRemoteHosts();
565 return true;
566 }
567
568 /**
569 * Cancels the the wizard and disconnects all open connections.
570 */
571 public void cancel() {
572 disconnectAllRemoteHosts();
573 }
574
575 // ------------------------------------------------------------------------
576 // Helper Methods
577 // ------------------------------------------------------------------------
578 private void disconnectAllRemoteHosts() {
579 for (RemoteImportConnectionNodeElement remoteHost : fRemoteHosts) {
580 remoteHost.disconnect();
581 }
582 }
583
584 private boolean updateViewer() {
585 Object elementViewerInput = createElementViewerInput();
586 if (elementViewerInput == null) {
587 return false;
588 }
589
590 CheckboxTreeViewer elementViewer = getElementViewer();
591 elementViewer.setInput(elementViewerInput);
592 elementViewer.expandToLevel(3);
593 setAllChecked(elementViewer, false, true);
594 updatePageCompletion();
595
596 return true;
597 }
598
599 private boolean validateProject() {
600 if (fCombo != null) {
601 int fProjectIndex = fCombo.getSelectionIndex();
602 if (fProjectIndex < 0) {
603 handleError(RemoteMessages.RemoteFetchLogWizardRemotePage_NoProjectSelectedError, null);
604 return false;
605 }
606
607 IProject project = fProjects.get(fProjectIndex);
608 IFolder traceFolder = project.getFolder(TmfTracesFolder.TRACES_FOLDER_NAME);
609
610 if (!traceFolder.exists()) {
611 handleError(RemoteMessages.RemoteFetchLogWizardRemotePage_InvalidTracingProject, null);
612 return false;
613 }
614
615 try {
616 if (project.hasNature(TmfProjectNature.ID)) {
617 TmfProjectElement projectElement = TmfProjectRegistry.getProject(project, true);
618 fTmfTraceFolder = projectElement.getTracesFolder();
619 fExperimentFolderElement = projectElement.getExperimentsFolder();
620 }
621 } catch (CoreException ex) {
622 handleError(RemoteMessages.RemoteFetchLogWizardRemotePage_InvalidTracingProject, ex);
623 return false;
624 }
625 }
626 return true;
627 }
628
629 }
This page took 0.047383 seconds and 5 git commands to generate.