1 /*******************************************************************************
2 * Copyright (c) 2015 Ericsson
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 * Bernd Hufmann - Initial API and implementation
11 *******************************************************************************/
12 package org
.eclipse
.tracecompass
.internal
.tmf
.remote
.ui
.wizards
.fetch
;
14 import java
.util
.List
;
16 import org
.eclipse
.jface
.dialogs
.IDialogSettings
;
17 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
18 import org
.eclipse
.jface
.viewers
.StructuredSelection
;
19 import org
.eclipse
.jface
.wizard
.Wizard
;
20 import org
.eclipse
.tracecompass
.internal
.tmf
.remote
.ui
.Activator
;
21 import org
.eclipse
.tracecompass
.internal
.tmf
.remote
.ui
.messages
.RemoteMessages
;
22 import org
.eclipse
.ui
.IImportWizard
;
23 import org
.eclipse
.ui
.IWorkbench
;
24 import org
.eclipse
.ui
.ide
.IDE
;
25 import org
.eclipse
.ui
.plugin
.AbstractUIPlugin
;
28 * Wizard for remote fetching of logs and traces.
30 public class RemoteFetchLogWizard
extends Wizard
implements IImportWizard
{
32 // ------------------------------------------------------------------------
34 // ------------------------------------------------------------------------
35 private static final String FETCH_LOG_WIZARD
= "RemoteFetchLogWizard"; //$NON-NLS-1$
36 private static final String PLUGIN_ID
= Activator
.PLUGIN_ID
;
37 private static final String ICON_PATH
= "icons/elcl16/fetch_log_wiz.gif"; //$NON-NLS-1$
39 // ------------------------------------------------------------------------
41 // ------------------------------------------------------------------------
42 private IStructuredSelection fSelection
;
43 private RemoteFetchLogWizardPage fFetchLogWizardPage
;
44 private RemoteFetchLogWizardRemotePage fFetchLogRemotePage
;
46 // ------------------------------------------------------------------------
48 // ------------------------------------------------------------------------
50 * Standard constructor
52 public RemoteFetchLogWizard() {
53 IDialogSettings workbenchSettings
= Activator
.getDefault().getDialogSettings();
54 IDialogSettings section
= workbenchSettings
55 .getSection(FETCH_LOG_WIZARD
);
56 if (section
== null) {
57 section
= workbenchSettings
.addNewSection(FETCH_LOG_WIZARD
);
59 setDialogSettings(section
);
62 // ------------------------------------------------------------------------
64 // ------------------------------------------------------------------------
66 public void init(IWorkbench workbench
, IStructuredSelection selection
) {
67 fSelection
= selection
;
69 List
<?
> selectedResources
= IDE
.computeSelectedResources(selection
);
70 if (!selectedResources
.isEmpty()) {
71 fSelection
= new StructuredSelection(selectedResources
);
74 setWindowTitle(RemoteMessages
.RemoteFetchLogWizard_Title
);
75 setDefaultPageImageDescriptor(AbstractUIPlugin
.imageDescriptorFromPlugin(PLUGIN_ID
, ICON_PATH
));
76 setNeedsProgressMonitor(true);
80 public void addPages() {
82 fFetchLogWizardPage
= new RemoteFetchLogWizardPage(RemoteMessages
.RemoteFetchLogWizardPage_Title
, fSelection
);
83 addPage(fFetchLogWizardPage
);
84 fFetchLogRemotePage
= new RemoteFetchLogWizardRemotePage(RemoteMessages
.RemoteFetchLogWizardRemotePage_Title
, fSelection
);
85 addPage(fFetchLogRemotePage
);
89 public boolean performFinish() {
90 return fFetchLogRemotePage
.finish();
94 public boolean performCancel() {
95 fFetchLogRemotePage
.cancel();
96 return super.performCancel();
100 public boolean canFinish() {
101 return fFetchLogWizardPage
.canFlipToNextPage();