Autopsy 4.23.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
McpOptionsPanelController.java
Go to the documentation of this file.
1/*
2 * Autopsy Forensic Browser
3 *
4 * Copyright 2026 Sleuth Kit Labs
5 * Contact: carrier <at> sleuthkit <dot> org
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19package org.sleuthkit.autopsy.mcp;
20
21import java.beans.PropertyChangeListener;
22import java.beans.PropertyChangeSupport;
23import java.util.logging.Level;
24import javax.swing.JComponent;
25import org.netbeans.spi.options.OptionsPanelController;
26import org.openide.util.HelpCtx;
27import org.openide.util.Lookup;
28import org.openide.util.NbBundle;
29import org.sleuthkit.autopsy.coreutils.Logger;
30import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
31
32@OptionsPanelController.TopLevelRegistration(
33 categoryName = "#OptionsCategory_Name_MCP",
34 iconBase = "org/sleuthkit/autopsy/mcp/options-icon.png",
35 position = 800,
36 keywords = "#OptionsCategory_Keywords_MCP",
37 keywordsCategory = "AI: MCP Server")
38public final class McpOptionsPanelController extends OptionsPanelController {
39
41 private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
42 private boolean changed;
43 private static final Logger logger = Logger.getLogger(McpOptionsPanelController.class.getName());
44
45 @Override
46 public void update() {
47 getPanel().load();
48 changed = false;
49 }
50
51 @Override
52 public void applyChanges() {
53 if (changed) {
54 getPanel().store();
55 changed = false;
56 }
57 }
58
59 @Override
60 public void cancel() {
61 }
62
63 @Override
64 public boolean isValid() {
65 return true;
66 }
67
68 @Override
69 public boolean isChanged() {
70 return changed;
71 }
72
73 @Override
74 public HelpCtx getHelpCtx() {
75 return null;
76 }
77
78 @Override
79 public JComponent getComponent(Lookup masterLookup) {
80 return getPanel();
81 }
82
83 @Override
84 public void addPropertyChangeListener(PropertyChangeListener l) {
85 pcs.addPropertyChangeListener(l);
86 }
87
88 @Override
89 public void removePropertyChangeListener(PropertyChangeListener l) {
90 pcs.removePropertyChangeListener(l);
91 }
92
94 if (panel == null) {
95 panel = new McpOptionsPanel(this);
96 }
97 return panel;
98 }
99
100 void changed() {
101 if (!changed) {
102 changed = true;
103 try {
104 pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
105 } catch (Exception ex) {
106 logger.log(Level.SEVERE, "McpOptionsPanelController listener threw exception", ex); //NON-NLS
107 MessageNotifyUtil.Notify.show(
108 NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"),
109 NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr.msg"),
110 MessageNotifyUtil.MessageType.ERROR);
111 }
112 }
113 try {
114 pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
115 } catch (Exception ex) {
116 logger.log(Level.SEVERE, "McpOptionsPanelController listener threw exception", ex); //NON-NLS
117 }
118 }
119}
synchronized static Logger getLogger(String name)
Definition Logger.java:124

Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.