1 package info.mikethomas.fahview.v6project.properties;
2
3 /*
4 * #%L
5 * This file is part of FAHView-v6project.
6 * %%
7 * Copyright (C) 2011 - 2017 Mike Thomas <mikepthomas@outlook.com>
8 * %%
9 * FAHView is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 * %
14 * FAHView is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 * %
19 * You should have received a copy of the GNU General Public License
20 * along with FAHView. If not, see <http://www.gnu.org/licenses/>.
21 * #L%
22 */
23
24 import info.mikethomas.fahview.v6project.ClientProject;
25 import java.awt.Dialog;
26 import java.awt.event.ActionEvent;
27 import java.awt.event.ActionListener;
28 import org.netbeans.api.project.ProjectUtils;
29 import org.netbeans.spi.project.ui.CustomizerProvider;
30 import org.netbeans.spi.project.ui.support.ProjectCustomizer;
31 import org.openide.awt.StatusDisplayer;
32 import org.openide.util.lookup.Lookups;
33
34 /**
35 * <p>ClientCustomizerProvider class.</p>
36 *
37 * @author <a href="mailto:mikepthomas@outlook.com">Michael Thomas</a>
38 * @version $Id: $Id
39 */
40 public class ClientCustomizerProvider implements CustomizerProvider {
41
42 /** Constant <code>CUSTOMIZER_FOLDER_PATH="Projects/info-mikethomas-fahview/Customi"{trunked}</code> */
43 public static final String CUSTOMIZER_FOLDER_PATH =
44 "Projects/info-mikethomas-fahview/Customizer";
45
46 private final ClientProject project;
47
48 /**
49 * <p>Constructor for ClientCustomizerProvider.</p>
50 *
51 * @param project a {@link info.mikethomas.fahview.v6project.ClientProject} object.
52 */
53 public ClientCustomizerProvider(ClientProject project) {
54 this.project = project;
55 }
56
57 /** {@inheritDoc} */
58 @Override
59 public void showCustomizer() {
60 Dialog dialog = ProjectCustomizer.createCustomizerDialog(
61 //Path to layer folder:
62 CUSTOMIZER_FOLDER_PATH,
63 //Lookup, which must contain, at least, the Project:
64 Lookups.fixed(project),
65 //Preselected category:
66 "",
67 //OK button listener:
68 new OKOptionListener(),
69 //HelpCtx for Help button of dialog:
70 null);
71 dialog.setTitle(ProjectUtils.getInformation(project).getDisplayName());
72 dialog.setVisible(true);
73 }
74
75 private class OKOptionListener implements ActionListener {
76
77 @Override
78 public void actionPerformed(ActionEvent e) {
79 StatusDisplayer.getDefault().setStatusText("OK button clicked for "
80 + project.getProjectDirectory().getName() + " customizer!");
81 }
82 }
83 }