/*
Copywrite 2016 Will Winder
This file is part of Universal Gcode Sender (UGS).
UGS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
UGS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with UGS. If not, see <http://www.gnu.org/licenses/>.
*/
package com.willwinder.ugs.nbp.core.toolbars;
import com.willwinder.ugs.nbp.lib.lookup.CentralLookup;
import com.willwinder.ugs.nbp.lib.services.LocalizingService;
import com.willwinder.universalgcodesender.model.BackendAPI;
import com.willwinder.universalgcodesender.uielements.toolbars.FileBrowsePanel;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
import org.openide.awt.ActionRegistration;
import org.openide.util.ImageUtilities;
import org.openide.util.actions.Presenter;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
/**
* @author wwinder
*/
@ActionID(
category = LocalizingService.FileBrowserToolbarCategory,
id = LocalizingService.FileBrowserToolbarActionId
)
@ActionRegistration(
iconBase = ConnectionSerialPortToolbar.ICON_BASE,
displayName = "resources.MessagesBundle#" + LocalizingService.FileBrowserToolbarTitleKey,
lazy = false
)
@ActionReferences({
@ActionReference(
path = "Toolbars/StartPauseStop",
position = 1020),
})
public final class FileBrowserToolbar extends AbstractAction implements Presenter.Toolbar {
public static final String ICON_BASE = "resources/icons/open.png";
public FileBrowserToolbar() {
putValue(SMALL_ICON, ImageUtilities.loadImageIcon(ICON_BASE, false));
putValue(NAME, LocalizingService.FileBrowserToolbarTitle);
}
@Override
public void actionPerformed(ActionEvent e) {
}
@Override
public Component getToolbarPresenter() {
BackendAPI backend = CentralLookup.getDefault().lookup(BackendAPI.class);
return new FileBrowsePanel(backend);
}
}