author | dadubrow |
Mon, 16 Aug 2010 10:18:18 -0500 | |
changeset 1832 | aaf2f7bc0609 |
parent 1824 | 7e34f628583a |
permissions | -rw-r--r-- |
1727
743cc54fdffe
more portal changes - add kits page + pref page links to customize
dadubrow
parents:
1721
diff
changeset
|
1 |
/* |
743cc54fdffe
more portal changes - add kits page + pref page links to customize
dadubrow
parents:
1721
diff
changeset
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
743cc54fdffe
more portal changes - add kits page + pref page links to customize
dadubrow
parents:
1721
diff
changeset
|
3 |
* All rights reserved. |
743cc54fdffe
more portal changes - add kits page + pref page links to customize
dadubrow
parents:
1721
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
743cc54fdffe
more portal changes - add kits page + pref page links to customize
dadubrow
parents:
1721
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
743cc54fdffe
more portal changes - add kits page + pref page links to customize
dadubrow
parents:
1721
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
743cc54fdffe
more portal changes - add kits page + pref page links to customize
dadubrow
parents:
1721
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
743cc54fdffe
more portal changes - add kits page + pref page links to customize
dadubrow
parents:
1721
diff
changeset
|
8 |
* |
743cc54fdffe
more portal changes - add kits page + pref page links to customize
dadubrow
parents:
1721
diff
changeset
|
9 |
* Initial Contributors: |
743cc54fdffe
more portal changes - add kits page + pref page links to customize
dadubrow
parents:
1721
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
743cc54fdffe
more portal changes - add kits page + pref page links to customize
dadubrow
parents:
1721
diff
changeset
|
11 |
* |
743cc54fdffe
more portal changes - add kits page + pref page links to customize
dadubrow
parents:
1721
diff
changeset
|
12 |
* Contributors: |
743cc54fdffe
more portal changes - add kits page + pref page links to customize
dadubrow
parents:
1721
diff
changeset
|
13 |
* |
743cc54fdffe
more portal changes - add kits page + pref page links to customize
dadubrow
parents:
1721
diff
changeset
|
14 |
* Description: |
743cc54fdffe
more portal changes - add kits page + pref page links to customize
dadubrow
parents:
1721
diff
changeset
|
15 |
* |
743cc54fdffe
more portal changes - add kits page + pref page links to customize
dadubrow
parents:
1721
diff
changeset
|
16 |
*/ |
1609 | 17 |
package com.nokia.carbide.internal.discovery.ui.view; |
18 |
||
19 |
||
1810
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
20 |
import java.util.ArrayList; |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
21 |
import java.util.Arrays; |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
22 |
import java.util.List; |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
23 |
|
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
24 |
import org.eclipse.jface.action.Action; |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
25 |
import org.eclipse.jface.action.IAction; |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
26 |
import org.eclipse.jface.viewers.StructuredSelection; |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
27 |
import org.eclipse.jface.wizard.WizardDialog; |
1609 | 28 |
import org.eclipse.swt.widgets.Composite; |
29 |
import org.eclipse.swt.widgets.Control; |
|
30 |
import org.eclipse.ui.IEditorPart; |
|
1810
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
31 |
import org.eclipse.ui.IWorkbenchWizard; |
1609 | 32 |
import org.eclipse.ui.PlatformUI; |
33 |
||
1824 | 34 |
import com.nokia.carbide.discovery.ui.Messages; |
1734 | 35 |
import com.nokia.carbide.internal.discovery.ui.extension.AbstractDiscoveryPortalPageLayer; |
1810
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
36 |
import com.nokia.carbide.internal.discovery.ui.extension.IActionBar; |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
37 |
import com.nokia.carbide.internal.discovery.ui.extension.IActionUIUpdater; |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
38 |
import com.nokia.carbide.internal.discovery.ui.wizard.ExportWizard; |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
39 |
import com.nokia.carbide.internal.discovery.ui.wizard.ImportWizard; |
1615 | 40 |
|
1734 | 41 |
public class InstallExtensionsPortalExtension extends AbstractDiscoveryPortalPageLayer { |
1609 | 42 |
|
1810
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
43 |
private final class MigrateBar implements IActionBar { |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
44 |
@Override |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
45 |
public String getTitle() { |
1824 | 46 |
return Messages.InstallExtensionsPortalExtension_MigrateTitle; |
1810
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
47 |
} |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
48 |
|
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
49 |
@Override |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
50 |
public String[] getHighlightedActionIds() { |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
51 |
return null; |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
52 |
} |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
53 |
|
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
54 |
@Override |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
55 |
public IAction[] getActions() { |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
56 |
List<IAction> actions = new ArrayList<IAction>(); |
1824 | 57 |
actions.add(new Action(Messages.InstallExtensionsPortalExtension_ExportActionLabel) { |
1810
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
58 |
@Override |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
59 |
public void run() { |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
60 |
showWizard(new ExportWizard()); |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
61 |
} |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
62 |
}); |
1824 | 63 |
actions.add(new Action(Messages.InstallExtensionsPortalExtension_ImportActionLabel) { |
1810
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
64 |
@Override |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
65 |
public void run() { |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
66 |
showWizard(new ImportWizard()); |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
67 |
} |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
68 |
}); |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
69 |
return (IAction[]) actions.toArray(new IAction[actions.size()]); |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
70 |
} |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
71 |
} |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
72 |
|
1609 | 73 |
@Override |
74 |
public Control createControl(Composite parent, IEditorPart part) { |
|
1734 | 75 |
Control control = super.createControl(parent, part); |
1609 | 76 |
|
1734 | 77 |
// Create the help context id for the viewer's control |
78 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(control, |
|
79 |
"com.nokia.carbide.discovery.ui.view.DiscoveryView.catalogviewer"); //$NON-NLS-1$ |
|
1609 | 80 |
|
1734 | 81 |
return control; |
1609 | 82 |
} |
1810
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
83 |
|
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
84 |
@Override |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
85 |
public IActionBar[] createCommandBars(IEditorPart part, IActionUIUpdater updater) { |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
86 |
List<IActionBar> commandBars = new ArrayList<IActionBar>( |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
87 |
Arrays.asList(super.createCommandBars(part, updater))); |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
88 |
commandBars.add(new MigrateBar()); |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
89 |
|
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
90 |
return (IActionBar[]) commandBars.toArray(new IActionBar[commandBars.size()]); |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
91 |
} |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
92 |
|
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
93 |
private void showWizard(IWorkbenchWizard wizard) { |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
94 |
wizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY); |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
95 |
WizardDialog dialog = new WizardDialog(part.getEditorSite().getShell(), wizard); |
1818 | 96 |
dialog.setMinimumPageSize(550, 250); |
1810
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
97 |
dialog.create(); |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
98 |
dialog.open(); |
2ccd3660a736
feature config exporter + non-functional importer
dadubrow
parents:
1734
diff
changeset
|
99 |
} |
1609 | 100 |
} |