analysis: Move plugins to their own sub-directory
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.remote.ui / src / org / eclipse / tracecompass / internal / tmf / remote / ui / wizards / fetch / RemoteFetchLogWizard.java
CommitLineData
417a4110
BH
1/*******************************************************************************
2 * Copyright (c) 2015 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 * Bernd Hufmann - Initial API and implementation
11 *******************************************************************************/
12package org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch;
13
14import java.util.List;
15
16import org.eclipse.jface.dialogs.IDialogSettings;
17import org.eclipse.jface.viewers.IStructuredSelection;
18import org.eclipse.jface.viewers.StructuredSelection;
19import org.eclipse.jface.wizard.Wizard;
20import org.eclipse.tracecompass.internal.tmf.remote.ui.Activator;
21import org.eclipse.tracecompass.internal.tmf.remote.ui.messages.RemoteMessages;
22import org.eclipse.ui.IImportWizard;
23import org.eclipse.ui.IWorkbench;
24import org.eclipse.ui.ide.IDE;
25import org.eclipse.ui.plugin.AbstractUIPlugin;
26
27/**
28 * Wizard for remote fetching of logs and traces.
29 */
30public class RemoteFetchLogWizard extends Wizard implements IImportWizard {
31
32 // ------------------------------------------------------------------------
33 // Constants
34 // ------------------------------------------------------------------------
35 private static final String FETCH_LOG_WIZARD = "RemoteFetchLogWizard"; //$NON-NLS-1$
abbc1d7e
BH
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$
417a4110
BH
38
39 // ------------------------------------------------------------------------
40 // Attributes
41 // ------------------------------------------------------------------------
42 private IStructuredSelection fSelection;
43 private RemoteFetchLogWizardPage fFetchLogWizardPage;
44 private RemoteFetchLogWizardRemotePage fFetchLogRemotePage;
45
46 // ------------------------------------------------------------------------
47 // Constructor(s)
48 // ------------------------------------------------------------------------
49 /**
50 * Standard constructor
51 */
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);
58 }
59 setDialogSettings(section);
60 }
61
62 // ------------------------------------------------------------------------
63 // Operations
64 // ------------------------------------------------------------------------
65 @Override
66 public void init(IWorkbench workbench, IStructuredSelection selection) {
67 fSelection = selection;
68
69 List<?> selectedResources = IDE.computeSelectedResources(selection);
70 if (!selectedResources.isEmpty()) {
71 fSelection = new StructuredSelection(selectedResources);
72 }
73
74 setWindowTitle(RemoteMessages.RemoteFetchLogWizard_Title);
75 setDefaultPageImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, ICON_PATH));
76 setNeedsProgressMonitor(true);
77 }
78
79 @Override
80 public void addPages() {
81 super.addPages();
82 fFetchLogWizardPage = new RemoteFetchLogWizardPage(RemoteMessages.RemoteFetchLogWizardPage_Title, fSelection);
83 addPage(fFetchLogWizardPage);
84 fFetchLogRemotePage = new RemoteFetchLogWizardRemotePage(RemoteMessages.RemoteFetchLogWizardRemotePage_Title, fSelection);
85 addPage(fFetchLogRemotePage);
86 }
87
88 @Override
89 public boolean performFinish() {
90 return fFetchLogRemotePage.finish();
91 }
92
93 @Override
94 public boolean performCancel() {
95 fFetchLogRemotePage.cancel();
96 return super.performCancel();
97 }
98
99 @Override
100 public boolean canFinish() {
101 return fFetchLogWizardPage.canFlipToNextPage();
102 }
103
104}
This page took 0.034881 seconds and 5 git commands to generate.