use of org.parosproxy.paros.view.View in project zaproxy by zaproxy.
the class PolicyPassiveScanPanel method getApplyToThresholdTarget.
private JComboBox<String> getApplyToThresholdTarget() {
if (applyToThresholdTarget == null) {
applyToThresholdTarget = new JComboBox<>();
applyToThresholdTarget.addItem(Constant.messages.getString("ascan.policy.table.quality.all"));
View view = View.getSingleton();
applyToThresholdTarget.addItem(view.getStatusUI(AddOn.Status.release).toString());
applyToThresholdTarget.addItem(view.getStatusUI(AddOn.Status.beta).toString());
applyToThresholdTarget.addItem(view.getStatusUI(AddOn.Status.alpha).toString());
}
return applyToThresholdTarget;
}
use of org.parosproxy.paros.view.View in project zaproxy by zaproxy.
the class GuiBootstrap method initControlAndPostViewInit.
/**
* Initialises the {@code Control} and does post {@code View} initialisations.
*
* @throws Exception if an error occurs during initialisation
* @see Control
* @see View
*/
private void initControlAndPostViewInit() throws Exception {
Control.initSingletonWithView(getControlOverrides());
final Control control = Control.getSingleton();
final View view = View.getSingleton();
EventQueue.invokeAndWait(new Runnable() {
@Override
public void run() {
view.postInit();
view.getMainFrame().setVisible(true);
boolean createNewSession = true;
if (getArgs().isEnabled(CommandLine.SESSION) && getArgs().isEnabled(CommandLine.NEW_SESSION)) {
view.showWarningDialog(Constant.messages.getString("start.gui.cmdline.invalid.session.options", CommandLine.SESSION, CommandLine.NEW_SESSION, Constant.getZapHome()));
} else if (getArgs().isEnabled(CommandLine.SESSION)) {
Path sessionPath = SessionUtils.getSessionPath(getArgs().getArgument(CommandLine.SESSION));
if (!Files.exists(sessionPath)) {
view.showWarningDialog(Constant.messages.getString("start.gui.cmdline.session.does.not.exist", Constant.getZapHome()));
} else {
createNewSession = !control.getMenuFileControl().openSession(sessionPath.toAbsolutePath().toString());
}
} else if (getArgs().isEnabled(CommandLine.NEW_SESSION)) {
Path sessionPath = SessionUtils.getSessionPath(getArgs().getArgument(CommandLine.NEW_SESSION));
if (Files.exists(sessionPath)) {
view.showWarningDialog(Constant.messages.getString("start.gui.cmdline.newsession.already.exist", Constant.getZapHome()));
} else {
createNewSession = !control.getMenuFileControl().newSession(sessionPath.toAbsolutePath().toString());
}
}
view.hideSplashScreen();
if (createNewSession) {
try {
control.getMenuFileControl().newSession(false);
} catch (Exception e) {
logger.error(e.getMessage(), e);
View.getSingleton().showWarningDialog(Constant.messages.getString("menu.file.newSession.error"));
}
}
}
});
try {
// Allow extensions to pick up command line args in GUI mode
control.getExtensionLoader().hookCommandLineListener(getArgs());
control.runCommandLine();
} catch (final Exception e) {
logger.error(e.getMessage(), e);
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
view.showWarningDialog(e.getMessage());
}
});
}
}
use of org.parosproxy.paros.view.View in project zaproxy by zaproxy.
the class PolicyAllCategoryPanel method createStatusComboBox.
/**
* Creates a {@code JComboBox} with scanners' statuses, "all", release, beta and alpha.
*
* @return a {@code JComboBox} with scanners' statuses
*/
private JComboBox<String> createStatusComboBox() {
JComboBox<String> comboBox = new JComboBox<>();
comboBox.addItem(Constant.messages.getString("ascan.policy.table.quality.all"));
View view = View.getSingleton();
comboBox.addItem(view.getStatusUI(AddOn.Status.release).toString());
comboBox.addItem(view.getStatusUI(AddOn.Status.beta).toString());
comboBox.addItem(view.getStatusUI(AddOn.Status.alpha).toString());
return comboBox;
}
use of org.parosproxy.paros.view.View in project zaproxy by zaproxy.
the class ExtensionLoaderUnitTest method shouldInitViewWhenStartingExtensionWithView.
@Test
void shouldInitViewWhenStartingExtensionWithView() throws Exception {
// Given
View view = mock(View.class);
extensionLoader = new ExtensionLoader(model, view);
Extension extension = mock(Extension.class);
// When
extensionLoader.startLifeCycle(extension);
// Then
verify(extension).initView(view);
}
Aggregations