use of bndtools.preferences.BndPreferences in project bndtools by bndtools.
the class BndBuildPreferencePage method init.
@Override
public void init(IWorkbench workbench) {
prefs = new BndPreferences();
buildLogging = prefs.getBuildLogging();
}
use of bndtools.preferences.BndPreferences in project bndtools by bndtools.
the class NativeBndLaunchDelegate method isAlreadyRunning.
/**
* Check if we already have a configuration running
*/
public boolean isAlreadyRunning(ILaunchConfiguration configuration) throws CoreException {
// Check for existing launches of same resource
BndPreferences prefs = new BndPreferences();
if (prefs.getWarnExistingLaunches()) {
IResource launchResource = LaunchUtils.getTargetResource(configuration);
if (launchResource == null)
return false;
int processCount = 0;
for (ILaunch l : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
// ... is it the same launch resource?
ILaunchConfiguration launchConfig = l.getLaunchConfiguration();
if (launchConfig == null) {
continue;
}
if (launchResource.equals(LaunchUtils.getTargetResource(launchConfig))) {
// Iterate existing processes
for (IProcess process : l.getProcesses()) {
if (!process.isTerminated())
processCount++;
}
}
}
// Warn if existing processes running
if (processCount > 0) {
Status status = new Status(IStatus.WARNING, Plugin.PLUGIN_ID, 0, "One or more OSGi Frameworks have already been launched for this configuration. Additional framework instances may interfere with each other due to the shared storage directory.", null);
IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(status);
if (prompter != null) {
boolean okay = (Boolean) prompter.handleStatus(status, launchResource);
return !okay;
}
}
}
return false;
}
use of bndtools.preferences.BndPreferences in project bndtools by bndtools.
the class AbstractOSGiLaunchDelegate method finalLaunchCheck.
@Override
public boolean finalLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
// Check for existing launches of same resource
BndPreferences prefs = new BndPreferences();
if (prefs.getWarnExistingLaunches()) {
IResource launchResource = LaunchUtils.getTargetResource(configuration);
if (launchResource == null)
throw new CoreException(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Bnd launch target was not specified or does not exist.", null));
int processCount = 0;
for (ILaunch l : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
// ... is it the same launch resource?
ILaunchConfiguration launchConfig = l.getLaunchConfiguration();
if (launchConfig == null) {
continue;
}
if (launchResource.equals(LaunchUtils.getTargetResource(launchConfig))) {
// Iterate existing processes
for (IProcess process : l.getProcesses()) {
if (!process.isTerminated())
processCount++;
}
}
}
// Warn if existing processes running
if (processCount > 0) {
Status status = new Status(IStatus.WARNING, Plugin.PLUGIN_ID, 0, "One or more OSGi Frameworks have already been launched for this configuration. Additional framework instances may interfere with each other due to the shared storage directory.", null);
IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(status);
if (prompter != null) {
boolean okay = (Boolean) prompter.handleStatus(status, launchResource);
if (!okay)
return okay;
}
}
}
IStatus launchStatus = getLauncherStatus();
IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(launchStatus);
if (prompter != null)
return (Boolean) prompter.handleStatus(launchStatus, run);
return true;
}
use of bndtools.preferences.BndPreferences in project bndtools by bndtools.
the class AbstractOSGiLaunchDelegate method buildForLaunch.
@Override
public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
BndPreferences prefs = new BndPreferences();
boolean result = !prefs.getBuildBeforeLaunch() || super.buildForLaunch(configuration, mode, monitor);
try {
run = LaunchUtils.createRun(configuration);
initialiseBndLauncher(configuration, run);
} catch (Exception e) {
throw new CoreException(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error initialising bnd launcher", e));
}
return result;
}
use of bndtools.preferences.BndPreferences in project bndtools by bndtools.
the class BndEditor method showHighestPriorityPage.
void showHighestPriorityPage() {
int selectedPrio = Integer.MIN_VALUE;
String selected = null;
BndPreferences prefs = new BndPreferences();
if (prefs.getEditorOpenSourceTab()) {
selected = SOURCE_PAGE;
selectedPrio = 0;
} else {
for (Object pageObj : pages) {
IFormPage page = (IFormPage) pageObj;
int priority = 0;
if (page instanceof IPriority)
priority = ((IPriority) page).getPriority();
if (priority > selectedPrio) {
selected = page.getId();
selectedPrio = priority;
}
}
}
if (selected != null)
setActivePage(selected);
}
Aggregations