[344289] Fix FindBug warnings in WAR Products
Work in progress
Signed-off-by: Hannes Erven <hannes@erven.at>
diff --git a/plugins/org.eclipse.libra.facet.ui/src/org/eclipse/libra/facet/ui/operations/ConvertProjectToBundleOperation.java b/plugins/org.eclipse.libra.facet.ui/src/org/eclipse/libra/facet/ui/operations/ConvertProjectToBundleOperation.java
index 46c38f5..11a0298 100644
--- a/plugins/org.eclipse.libra.facet.ui/src/org/eclipse/libra/facet/ui/operations/ConvertProjectToBundleOperation.java
+++ b/plugins/org.eclipse.libra.facet.ui/src/org/eclipse/libra/facet/ui/operations/ConvertProjectToBundleOperation.java
@@ -17,8 +17,6 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.pde.core.project.IBundleProjectDescription;
-import org.eclipse.pde.core.project.IBundleProjectService;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
@@ -27,8 +25,6 @@
public class ConvertProjectToBundleOperation extends WorkspaceModifyOperation {
protected IProject fProject;
- protected IBundleProjectService fBundleProjectService;
- protected IBundleProjectDescription fBundleProjectDescription;
public ConvertProjectToBundleOperation(IProject project) {
this.fProject = project;
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/PingThread.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/PingThread.java
index b08f870..53a7bce 100644
--- a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/PingThread.java
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/PingThread.java
@@ -33,7 +33,6 @@
private int maxPings;
private boolean stop = false;
- private String url;
private IServer server;
private ILaunch launch;
private OSGIFrameworkInstanceBehaviorDelegate behaviour;
@@ -52,7 +51,6 @@
OSGIFrameworkInstanceBehaviorDelegate behaviour) {
super();
this.server = server;
- this.url = url;
this.maxPings = maxPings;
this.behaviour = behaviour;
this.launch = launch;
@@ -95,15 +93,15 @@
server.stop(true);
stop = true;
break;
- } else {
- Trace.trace(Trace.FINEST, "Ping: pinging " + count);
- IProcess[] procs = launch.getProcesses();
- if (procs != null && procs.length > 0) {
- if (!procs[0].isTerminated()) {
- behaviour.setServerStarted();
- stop();
- break;
- }
+ }
+
+ Trace.trace(Trace.FINEST, "Ping: pinging " + count);
+ IProcess[] procs = launch.getProcesses();
+ if (procs != null && procs.length > 0) {
+ if (!procs[0].isTerminated()) {
+ behaviour.setServerStarted();
+ stop();
+ break;
}
}
@@ -114,7 +112,7 @@
try {
Thread.sleep(PING_INTERVAL);
} catch (InterruptedException e2) {
-
+ // need not be handled
}
}
}
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/Trace.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/Trace.java
index 07029f4..a6a003d 100644
--- a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/Trace.java
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/Trace.java
@@ -34,7 +34,7 @@
private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy HH:mm.ss.SSS");
- protected static int pluginLength = -1;
+ static int pluginLength = -1;
/**
* Trace constructor comment.
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/internal/debug/OSGIRuntimeSourcePathComputerDelegate.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/internal/debug/OSGIRuntimeSourcePathComputerDelegate.java
index 531c7d9..dcef9f1 100644
--- a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/internal/debug/OSGIRuntimeSourcePathComputerDelegate.java
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/internal/debug/OSGIRuntimeSourcePathComputerDelegate.java
@@ -61,7 +61,7 @@
return visitor.getSourceContainers();
}
- class SourcePathComputerVisitor implements IModuleVisitor {
+ static class SourcePathComputerVisitor implements IModuleVisitor {
final ILaunchConfiguration configuration;
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/launching/LaunchConfigurationDelegate.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/launching/LaunchConfigurationDelegate.java
index aedf0d5..1702230 100644
--- a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/launching/LaunchConfigurationDelegate.java
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/launching/LaunchConfigurationDelegate.java
@@ -49,6 +49,7 @@
if (server == null) {
Trace.trace(Trace.FINEST,
"Launch configuration could not find runtime instance");
+ return ;
}
// This should be handled by the action that starts/debugs not here
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/module/OsgiModuleDeployableFactory.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/module/OsgiModuleDeployableFactory.java
index ab5fc62..b8cc622 100644
--- a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/module/OsgiModuleDeployableFactory.java
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/module/OsgiModuleDeployableFactory.java
@@ -53,10 +53,7 @@
if (component == null) {
component = new VirtualComponent(project, new Path("/")); //$NON-NLS-1$
}
- if (component != null) {
- return createModuleDelegates(component);
- }
- return null;
+ return createModuleDelegates(component);
}
private IModule[] createModuleDelegates(IVirtualComponent component) {
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/publish/PublishHelper.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/publish/PublishHelper.java
index 2b08535..e86be40 100644
--- a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/publish/PublishHelper.java
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/publish/PublishHelper.java
@@ -118,7 +118,6 @@
}
public TargetBundle[] getTargetBundles(FrameworkInstanceConfiguration config) {
- List<String> all = new ArrayList<String>();
ITargetDefinition targetDefinition = config.getTargetDefinition();
targetDefinition.resolve(new NullProgressMonitor());
TargetBundle[] targetBundles = targetDefinition.getBundles();
@@ -250,10 +249,9 @@
}
}
}
- } else {
}
} catch (Exception e) {
-
+ e.printStackTrace();
}
}
}
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/dependencies/BundleDependencyEditorPage.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/dependencies/BundleDependencyEditorPage.java
index acb669e..719c10a 100644
--- a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/dependencies/BundleDependencyEditorPage.java
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/dependencies/BundleDependencyEditorPage.java
@@ -314,6 +314,7 @@
IStatus status = EditorUIPlugin.newErrorStatus("Bundle Dependency Graph editor part is not integrated with the runtime.");
EditorUIPlugin.log(status);
setStatus(status);
+ return ;
}
try {
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/AbstractBundleEditorPage.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/AbstractBundleEditorPage.java
index 26f6027..470675b 100644
--- a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/AbstractBundleEditorPage.java
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/AbstractBundleEditorPage.java
@@ -65,14 +65,14 @@
public StartServerAction(String launchMode) {
this.launchMode = launchMode;
- if (launchMode == ILaunchManager.RUN_MODE) {
+ if (ILaunchManager.RUN_MODE.equals(launchMode)) {
setToolTipText(Messages.actionStartToolTip);
setText(Messages.actionStart);
setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_START));
setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_START));
setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_START));
}
- else if (launchMode == ILaunchManager.DEBUG_MODE) {
+ else if (ILaunchManager.DEBUG_MODE.equals(launchMode)) {
setToolTipText(Messages.actionDebugToolTip);
setText(Messages.actionDebug);
setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_START_DEBUG));
@@ -158,6 +158,7 @@
}
public void setFocus() {
+ // nothing
}
protected abstract void createBundleContent(Composite parent);
@@ -215,7 +216,7 @@
/**
* Converts an IStatus message type to Form message type.
*/
- private int getMessageType(IStatus status) {
+ private static int getMessageType(IStatus status) {
switch (status.getSeverity()) {
case IStatus.ERROR:
return IMessageProvider.ERROR;
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyContentProvider.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyContentProvider.java
index f4a8ebc..cb6c321 100644
--- a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyContentProvider.java
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyContentProvider.java
@@ -80,6 +80,7 @@
}
public void dispose() {
+ // empty method
}
public BundleDependencyContentResult getContentResult() {
@@ -97,12 +98,12 @@
public Object[] getElements(Object input) {
if (input instanceof Collection) {
dependenciesByBundle = new HashMap<IBundle, Set<BundleDependency>>();
- Set<IBundle> bundles = new HashSet<IBundle>((Collection<IBundle>) input);
+ Set<IBundle> bundleset = new HashSet<IBundle>((Collection<IBundle>) input);
if (!"type filter text".equals(searchControl.getSearchText().getText())
&& searchControl.getSearchText().getText().trim().length() > 0) {
String searchText = searchControl.getSearchText().getText().trim() + "*";
StringMatcher matcher = new StringMatcher(searchText, true, false);
- for (IBundle dep : new HashSet<IBundle>(bundles)) {
+ for (IBundle dep : new HashSet<IBundle>(bundleset)) {
boolean filter = true;
if (matcher.match(dep.getSymbolicName())) {
filter = false;
@@ -111,15 +112,15 @@
filter = false;
}
if (filter) {
- bundles.remove(dep);
+ bundleset.remove(dep);
}
}
}
- this.contentResult = new BundleDependencyContentResult(bundles);
+ this.contentResult = new BundleDependencyContentResult(bundleset);
Set<BundleDependency> dependencies = new HashSet<BundleDependency>();
if (showPackage) {
- Set<IBundle> bundlesToProcess = new HashSet<IBundle>(bundles);
+ Set<IBundle> bundlesToProcess = new HashSet<IBundle>(bundleset);
Set<IBundle> alreadyProcessedBundles = new HashSet<IBundle>();
int degree = 0;
@@ -133,7 +134,7 @@
}
} while (bundlesToProcess.size() > 0);
- bundlesToProcess = new HashSet<IBundle>(bundles);
+ bundlesToProcess = new HashSet<IBundle>(bundleset);
alreadyProcessedBundles = new HashSet<IBundle>();
degree = 0;
@@ -148,7 +149,7 @@
} while (bundlesToProcess.size() > 0);
}
else if (showServices) {
- Set<IBundle> bundlesToProcess = new HashSet<IBundle>(bundles);
+ Set<IBundle> bundlesToProcess = new HashSet<IBundle>(bundleset);
Set<IBundle> alreadyProcessedBundles = new HashSet<IBundle>();
int degree = 0;
@@ -162,7 +163,7 @@
}
} while (bundlesToProcess.size() > 0);
- bundlesToProcess = new HashSet<IBundle>(bundles);
+ bundlesToProcess = new HashSet<IBundle>(bundleset);
alreadyProcessedBundles = new HashSet<IBundle>();
degree = 0;
@@ -194,7 +195,8 @@
return null;
}
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ public void inputChanged(Viewer theViewer, Object oldInput, Object newInput) {
+ // empty method
}
public boolean isSelected(IBundle bundle) {
@@ -216,24 +218,19 @@
viewer.unReveal(dep);
}
selectedDependencies = new HashSet<BundleDependency>();
- Set<Object> newSelection = new HashSet<Object>();
Iterator<Object> iterator = ((IStructuredSelection) event.getSelection()).iterator();
while (iterator.hasNext()) {
Object selectedObject = iterator.next();
if (selectedObject instanceof IBundle) {
- newSelection.add(selectedObject);
if (dependenciesByBundle.containsKey(selectedObject)) {
for (BundleDependency dep : dependenciesByBundle.get(selectedObject)) {
selectedDependencies.add(dep);
- newSelection.add(dep.getExportingBundle());
}
}
}
else if (selectedObject instanceof BundleDependency) {
BundleDependency dep = (BundleDependency) selectedObject;
selectedDependencies.add(dep);
- newSelection.add(dep.getExportingBundle());
- newSelection.add(dep.getImportingBundle());
}
}
@@ -314,7 +311,7 @@
bundleDependencies.add(bundleDependency);
dependencies.add(bundleDependency);
}
- contentResult.addIncomingDependency(degree, dependantBundle);
+ contentResult.addIncomingDependency(Integer.valueOf(degree), dependantBundle);
bundleDependency.addPackageImport(packageImport);
dependentBundles.add(dependantBundle);
@@ -366,7 +363,7 @@
bundleDependencies.add(bundleDependency);
dependencies.add(bundleDependency);
}
- contentResult.addIncomingDependency(degree, dependantBundle);
+ contentResult.addIncomingDependency(Integer.valueOf(degree), dependantBundle);
bundleDependency.addServiceReferece(pe);
dependentBundles.add(dependantBundle);
@@ -417,7 +414,7 @@
bundleDependencies.add(bundleDependency);
dependencies.add(bundleDependency);
}
- contentResult.addOutgoingDependency(degree, dependantBundle);
+ contentResult.addOutgoingDependency(Integer.valueOf(degree), dependantBundle);
bundleDependency.addPackageImport(pe);
dependentBundles.add(dependantBundle);
@@ -466,7 +463,7 @@
bundleDependencies.add(bundleDependency);
dependencies.add(bundleDependency);
}
- contentResult.addOutgoingDependency(degree, dependantBundle);
+ contentResult.addOutgoingDependency(Integer.valueOf(degree), dependantBundle);
bundleDependency.addServiceReferece(pe);
dependentBundles.add(dependantBundle);
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyLayoutAlgorithm.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyLayoutAlgorithm.java
index d3bbd0b..e474ca7 100644
--- a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyLayoutAlgorithm.java
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyLayoutAlgorithm.java
@@ -41,28 +41,28 @@
double boundsX, double boundsY, double boundsWidth, double boundsHeight) {
BundleDependencyContentResult contentResult = this.contentProvider.getContentResult();
- Set<IBundle> rootBundles = contentResult.getBundles();
-
- Set<IBundle> bundlesProcessed = new HashSet<IBundle>();
if (contentResult != null) {
+ Set<IBundle> rootBundles = contentResult.getBundles();
+ Set<IBundle> bundlesProcessed = new HashSet<IBundle>();
+
Set<ColumnHolder> columnNodes = new HashSet<ColumnHolder>();
double columnWith = 0;
double currentX = boundsX + 0;
double currentY = boundsY + 10;
double maxY = boundsHeight;
- int columns = 0;
// Start with the incoming dependencies
- int degree = contentResult.getIncomingDegree();
+ int degree = contentResult.getIncomingDegree().intValue();
while (degree > 0) {
Set<InternalNode> degreeNodes = new HashSet<InternalNode>();
- Set<IBundle> deps = contentResult.getIncomingDependencies().get(degree);
+ Set<IBundle> deps = contentResult.getIncomingDependencies().get(Integer.valueOf(degree));
for (IBundle bundle : deps) {
if (!bundlesProcessed.contains(bundle)
&& !rootBundles.contains(bundle)
- && lowestRanking(bundle, contentResult.getIncomingDegree(), contentResult
- .getIncomingDependencies()) == degree) {
+ && lowestRanking(bundle, degree,
+ contentResult.getIncomingDependencies()) == degree
+ ) {
for (InternalNode node : entitiesToLayout) {
LayoutEntity obj = node.getLayoutEntity();
IBundle graphBundle = (IBundle) ((GraphNode) obj.getGraphData()).getData();
@@ -88,11 +88,10 @@
}
ColumnHolder holder = new ColumnHolder();
- holder.index = columns;
holder.y = currentY;
holder.nodes = degreeNodes;
columnNodes.add(holder);
- columns++;
+
currentY = boundsY + 10;
if (degreeNodes.size() > 0) {
currentX = currentX + columnWith + 30;
@@ -125,7 +124,6 @@
}
ColumnHolder holder = new ColumnHolder();
- holder.index = columns;
holder.y = currentY;
holder.nodes = rootNodes;
columnNodes.add(holder);
@@ -166,7 +164,6 @@
}
}
holder = new ColumnHolder();
- holder.index = columns;
holder.y = currentY;
holder.nodes = degreeNodes;
columnNodes.add(holder);
@@ -230,11 +227,9 @@
public void setLayoutArea(double x, double y, double width, double height) {
}
- class ColumnHolder {
+ static class ColumnHolder {
protected double y;
- protected int index;
-
protected Set<InternalNode> nodes;
}
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationDetailsPart.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationDetailsPart.java
index b36cc64..de29272 100644
--- a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationDetailsPart.java
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationDetailsPart.java
@@ -184,7 +184,7 @@
}
}
- class PackageLabelProvider extends LabelProvider {
+ static class PackageLabelProvider extends LabelProvider {
/*
* (non-Javadoc)
@@ -221,7 +221,7 @@
}
}
- class ServicePropertyComparator extends ViewerComparator {
+ static class ServicePropertyComparator extends ViewerComparator {
@SuppressWarnings("unchecked")
@Override
@@ -232,7 +232,7 @@
}
}
- class ServicePropertyContentProvider implements IStructuredContentProvider {
+ static class ServicePropertyContentProvider implements IStructuredContentProvider {
private IServiceReference ref;
@@ -257,7 +257,7 @@
}
- class ServicePropertyLabelProvider extends LabelProvider implements ITableLabelProvider {
+ static class ServicePropertyLabelProvider extends LabelProvider implements ITableLabelProvider {
public Image getColumnImage(Object element, int columnIndex) {
return null;
@@ -354,7 +354,7 @@
}
}
- class ServicesLabelProvider extends LabelProvider {
+ static class ServicesLabelProvider extends LabelProvider {
@Override
public Image getImage(Object element) {
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationMasterDetailsBlock.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationMasterDetailsBlock.java
index 18af1c6..44931c4 100644
--- a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationMasterDetailsBlock.java
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationMasterDetailsBlock.java
@@ -207,6 +207,9 @@
case SWT.Resize:
hookSashListeners();
break;
+ default:
+ // only above events need to be taken care of
+ break;
}
}
};
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationMasterPart.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationMasterPart.java
index 317afc2..331adb5 100644
--- a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationMasterPart.java
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationMasterPart.java
@@ -333,6 +333,7 @@
IStatus status = EditorUIPlugin.newErrorStatus("Bundle Overview editor part is not integrated with the runtime.");
EditorUIPlugin.log(status);
masterDetailsBlock.getEditorPage().setStatus(status);
+ return ;
}
try {
@@ -378,7 +379,7 @@
bundleTableViewer.setInput(null);
}
- class BundleStatusContentProvider implements IStructuredContentProvider {
+ static class BundleStatusContentProvider implements IStructuredContentProvider {
private Map<Long, IBundle> bundles;
@@ -404,7 +405,7 @@
}
- class BundleStatusLabelProvider extends LabelProvider implements ITableLabelProvider {
+ static class BundleStatusLabelProvider extends LabelProvider implements ITableLabelProvider {
public Image getColumnImage(Object element, int columnIndex) {
switch (columnIndex) {
@@ -430,7 +431,7 @@
}
}
- class BundleStatusComparator extends ViewerComparator {
+ static class BundleStatusComparator extends ViewerComparator {
@Override
public void sort(Viewer viewer, Object[] elements) {
Arrays.sort(elements, new Comparator<Object>() {
@@ -473,7 +474,7 @@
}
}
- class BundleSorter extends ViewerComparator {
+ static class BundleSorter extends ViewerComparator {
private final SORT_COLUMN sortColumn;
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/src/org/eclipse/libra/framework/equinox/ui/internal/ConfigurationPropertyTester.java b/plugins/org.eclipse.libra.framework.equinox.ui/src/org/eclipse/libra/framework/equinox/ui/internal/ConfigurationPropertyTester.java
index b3a72cb..5f0db26 100644
--- a/plugins/org.eclipse.libra.framework.equinox.ui/src/org/eclipse/libra/framework/equinox/ui/internal/ConfigurationPropertyTester.java
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/src/org/eclipse/libra/framework/equinox/ui/internal/ConfigurationPropertyTester.java
@@ -26,8 +26,7 @@
try {
IServerAttributes server = (IServerAttributes) receiver;
FrameworkInstanceDelegate equinox = (FrameworkInstanceDelegate) server.loadAdapter(IEquinoxFrameworkInstance.class, null);
- if (equinox != null)
- return equinox != null;
+ return equinox != null;
} catch (Exception e) {
// ignore
}
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxHandler.java b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxHandler.java
index a65cd90..9263382 100644
--- a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxHandler.java
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxHandler.java
@@ -47,7 +47,7 @@
IPath plugins = location.append("plugins");
if (plugins.toFile().exists()) {
File[] files = plugins.toFile().listFiles();
- for (File file : files) {
+ if (files!=null) for (File file : files) {
if (file.getName().indexOf("org.eclipse.osgi_") > -1) {
isFound = true;
break;
@@ -73,7 +73,7 @@
if (plugins.toFile().exists()) {
File[] files = plugins.toFile().listFiles();
- for (File file : files) {
+ if (files!=null) for (File file : files) {
if (file.getName().indexOf("org.eclipse.osgi_") > -1) {
IPath path = plugins.append(file.getName());
cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(path));
@@ -132,6 +132,7 @@
}else if(javaProfileProps != null){
FileOutputStream os = new FileOutputStream(new File(profilePath));
javaProfileProps.store(os, "THIS FILE IS AUTO GENERATED");
+ os.close();
}
} catch (IOException e) {
Trace.trace(Trace.SEVERE, "Could not set equinox VM arguments:"+e.getMessage(), e);
@@ -144,9 +145,8 @@
if(jmxEnabled)
return new String[] {"-Dcom.sun.management.jmxremote.port="+jmxPort, "-Dcom.sun.management.jmxremote.authenticate=false", "-Dcom.sun.management.jmxremote.ssl=false", "-Declipse.ignoreApp=true", "-Dosgi.noShutdown=true", vmArgs };
- else
- return new String[] { "-Declipse.ignoreApp=true", "-Dosgi.noShutdown=true", vmArgs };
-
+
+ return new String[] { "-Declipse.ignoreApp=true", "-Dosgi.noShutdown=true", vmArgs };
}
public IStatus canAddModule(IModule module) {
@@ -170,15 +170,16 @@
+ deployPath.toOSString());
// Prepare a directory structure
- File temp = deployPath.append("plugins").toFile();
- if (!temp.exists())
- temp.mkdirs();
- temp = deployPath.append("auto").toFile();
- if (!temp.exists())
- temp.mkdirs();
- temp = deployPath.append("cache").toFile();
- if (!temp.exists())
- temp.mkdirs();
+ final String[] subdirs = new String[]{"plugins", "auto", "cache"};
+ for(final String subdir: subdirs){
+ File temp = deployPath.append(subdir).toFile();
+ if (temp.exists() && temp.isDirectory()) continue;
+
+ if (! temp.mkdirs())
+ return new Status(IStatus.ERROR, EquinoxPlugin.PLUGIN_ID, 0,
+ Messages.errorIOerror+temp, null);
+
+ }
return Status.OK_STATUS;
}
@@ -195,9 +196,9 @@
prepareConfigIni(configPath, wsBundleIds, frameworkJar, kernelBundles);
}
- private void prepareConfigIni(IPath configPath, String[] wsBundleIds, String frameworkJar,
+ private static void prepareConfigIni(IPath configPath, String[] wsBundleIds, String frameworkJar,
TargetBundle[] krBundles) {
- String propertyInstall = "";
+ StringBuilder propertyInstall = new StringBuilder();
for (String bundle : wsBundleIds) {
if (bundle.indexOf("@") != -1)
bundle = bundle.substring(0, bundle.indexOf("@"));
@@ -209,9 +210,9 @@
if(bpath.endsWith("/"))
bpath = bpath.substring(0,bpath.length()-1);
if(iPluginModelBase.isFragmentModel())
- propertyInstall += "reference:file:" + bpath+ ", ";
+ propertyInstall.append("reference:file:" + bpath+ ", ");
else
- propertyInstall += "reference:file:" + bpath+ "@start, ";
+ propertyInstall.append("reference:file:" + bpath+ "@start, ");
}
}
}
@@ -231,28 +232,30 @@
properties.put(
"osgi.bundles.defaultStartLevel", Integer.toString(start)); //$NON-NLS-1$
for (int i = 0; i < krBundles.length; i++) {
- String targetBundlePath = "reference:file:"+krBundles[i].getBundleInfo().getLocation().getRawPath();
- if (targetBundlePath != null && !(targetBundlePath.trim().equalsIgnoreCase(""))) {
- if (targetBundlePath.indexOf("org.eclipse.osgi_") > -1)
+ String targetBundleRawpath = krBundles[i].getBundleInfo().getLocation().getRawPath();
+ if (targetBundleRawpath != null && !(targetBundleRawpath.trim().equalsIgnoreCase(""))) {
+ if (targetBundleRawpath.indexOf("org.eclipse.osgi_") > -1)
continue;
-
+
+ String targetBundlePath = "reference:file:"+targetBundleRawpath;
+
File file = new File(targetBundlePath.substring(targetBundlePath.indexOf("/")));
if (file.isFile()) {
- propertyInstall += targetBundlePath;
+ propertyInstall.append(targetBundlePath);
if(krBundles[i].isFragment())
- propertyInstall += ", ";
+ propertyInstall.append(", ");
else
- propertyInstall += "@start, ";
+ propertyInstall.append("@start, ");
} else {
for (String string2 : file.list()) {
if (string2.indexOf(".jar") > -1) {
- propertyInstall += targetBundlePath + string2;
+ propertyInstall.append(targetBundlePath + string2);
String fbundleId = getBundleId(string2);
- IPluginModelBase modelBase = PluginRegistry.findModel(fbundleId);
+// IPluginModelBase modelBase = PluginRegistry.findModel(fbundleId);
if(krBundles[i].isFragment())
- propertyInstall += ", ";
+ propertyInstall.append(", ");
else
- propertyInstall += "@start, ";
+ propertyInstall.append("@start, ");
}
}
}
@@ -260,7 +263,7 @@
}
- properties.setProperty("osgi.bundles", propertyInstall);
+ properties.setProperty("osgi.bundles", propertyInstall.toString());
properties.put("eclipse.ignoreApp", "true"); //$NON-NLS-1$ //$NON-NLS-2$
properties.put("osgi.noShutdown", "true"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -273,7 +276,7 @@
}
}
- private String getBundleId(String targetBundlePath) {
+ private static String getBundleId(String targetBundlePath) {
IPath kbPath = new Path(targetBundlePath);
String bundleId = kbPath.lastSegment();
if(bundleId.endsWith(".jar"))
@@ -284,7 +287,7 @@
return bundleId;
}
- private String[] prepareDevProperties(IPath configPath, String[] wsBundleIds) {
+ private static String[] prepareDevProperties(IPath configPath, String[] wsBundleIds) {
try {
// Create file
FileWriter fstream = new FileWriter(configPath.toPortableString()
@@ -332,7 +335,7 @@
}
- private void copyFile(InputStream source, File destFile) throws IOException {
+ private static void copyFile(InputStream source, File destFile) throws IOException {
FileOutputStream destination = null;
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/Messages.java b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/Messages.java
index 21a983d..ef9cda8 100644
--- a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/Messages.java
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/Messages.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.libra.framework.equinox;
+import java.io.File;
+
import org.eclipse.osgi.util.NLS;
/**
* Translated messages.
@@ -23,6 +25,7 @@
public static String errorNotBundle;
public static String errorOSGiBundlesOnly;
public static String errorNoRuntime;
+ public static String errorIOerror;
public static String publishServerTask;
public static String errorConfigurationProjectClosed;
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/Messages.properties b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/Messages.properties
index 88dac69..760c868 100644
--- a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/Messages.properties
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/Messages.properties
@@ -17,4 +17,5 @@
warningCantReadBundle=Cannot locate the correct bundle folder. Invalid Installation folder
errorNotBundle=Must be an osgi bundle
errorOSGiBundlesOnly=Must be an osgi bundle
-errorNoRuntime=There is no runtime
\ No newline at end of file
+errorNoRuntime=There is no runtime
+errorIOerror=IO Error accessing/creating file:
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/ConfigurationOSGiModuleEditorPart.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/ConfigurationOSGiModuleEditorPart.java
index 507e73f..2e6918f 100644
--- a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/ConfigurationOSGiModuleEditorPart.java
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/ConfigurationOSGiModuleEditorPart.java
@@ -45,7 +45,6 @@
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
@@ -66,13 +65,9 @@
*/
public class ConfigurationOSGiModuleEditorPart extends ServerEditorPart implements ISelectionProvider {
- protected IOSGIFrameworkWorkingCopy framework2;
protected FrameworkInstanceConfiguration configuration;
protected Table osgiBundlesTable;
- protected int selection = -1;
- protected Button addBundleProject;
- protected Button remove;
protected PropertyChangeListener listener;
@@ -213,10 +208,10 @@
Trace.trace(Trace.SEVERE, "cannot access configuration",e);
}
- if (server != null)
- framework2 = (IOSGIFrameworkWorkingCopy) server.loadAdapter(
- IOSGIFrameworkWorkingCopy.class, null);
-
+ if (server != null){
+ server.loadAdapter(IOSGIFrameworkWorkingCopy.class, null);
+ }
+
addChangeListener();
initialize();
}
@@ -239,14 +234,12 @@
if (readOnly)
return;
- try {
- selection = osgiBundlesTable.getSelectionIndex();
- remove.setEnabled(true);
- for(ISelectionChangedListener changedListener: selectionChangedListeners)
+ for(ISelectionChangedListener changedListener: selectionChangedListeners){
+ try {
changedListener.selectionChanged(new SelectionChangedEvent(this, getSelection()));
- } catch (Exception e) {
- selection = -1;
- remove.setEnabled(false);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
}
@@ -268,16 +261,6 @@
*/
protected Collection<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>();
- /**
- * This keeps track of the selection of the editor as a whole.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected ISelection editorSelection = StructuredSelection.EMPTY;
-
-
-
public ISelection getSelection() {
final TableItem[] sel = osgiBundlesTable.getSelection();
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/FrameworkInstanceLocationEditorSection.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/FrameworkInstanceLocationEditorSection.java
index 144e109..e300217 100644
--- a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/FrameworkInstanceLocationEditorSection.java
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/FrameworkInstanceLocationEditorSection.java
@@ -73,8 +73,6 @@
protected Section section;
protected IOSGIFrameworkInstance frameworkInstance;
- protected boolean defaultDeployDirIsSet;
-
protected Button frameworkInstanceDirCustom;
protected Text frameworkInstanceDir;
@@ -88,7 +86,6 @@
protected IPath workspacePath;
protected boolean allowRestrictedEditing;
- protected IPath tempDirPath;
protected IPath installDirPath;
protected boolean updating=false;
@@ -314,7 +311,7 @@
if (!readOnly) {
// If server has not been published, or server is published with no modules, allow editing
// TODO Find better way to determine if server hasn't been published
- if ((basePath != null && !basePath.append("conf").toFile().exists())
+ if ((!basePath.append("conf").toFile().exists())
|| (server.getOriginal().getServerPublishState() == IServer.PUBLISH_STATE_NONE
&& server.getOriginal().getModules().length == 0)) {
allowRestrictedEditing = true;
@@ -344,11 +341,6 @@
String dir = null;
if (frameworkInstanceDir != null) {
dir = frameworkInstanceDir.getText().trim();
- IPath path = new Path(dir);
- // Adjust if the temp dir is known and has been entered
- if (tempDirPath != null && tempDirPath.equals(path))
- dir = null;
-
}
return dir;
}
@@ -356,7 +348,7 @@
protected void updateServerDirButtons() {
if (frameworkInstance.getInstanceDirectory() == null) {
IPath path = new Path(frameworkInstance.getInstanceDirectory());
- if (path != null && path.equals(installDirPath)) {
+ if (path.equals(installDirPath)) {
frameworkInstanceDirCustom.setSelection(false);
} else {
frameworkInstanceDirCustom.setSelection(false);
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/TargetChangedCommand.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/TargetChangedCommand.java
index 8a73f70..7fcfd4d 100644
--- a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/TargetChangedCommand.java
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/TargetChangedCommand.java
@@ -22,7 +22,6 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.libra.framework.core.Messages;
-import org.eclipse.pde.core.plugin.IPluginModelBase;
import org.eclipse.pde.core.target.ITargetDefinition;
@@ -33,18 +32,12 @@
* because the content of the target definition has changed.
*/
public class TargetChangedCommand extends AbstractOperation {
- protected IPluginModelBase module;
- protected int modules = -1;
-
-
public TargetChangedCommand(ITargetDefinition definition) {
super( Messages.configurationEditorActionAddOsgiModule);
}
-
-
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/TargetDefinitionEditorPart.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/TargetDefinitionEditorPart.java
index f25702c..2c5b984 100644
--- a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/TargetDefinitionEditorPart.java
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/TargetDefinitionEditorPart.java
@@ -40,10 +40,10 @@
import org.eclipse.libra.framework.core.IOSGIFrameworkWorkingCopy;
import org.eclipse.libra.framework.core.TargetDefinitionUtil;
import org.eclipse.libra.framework.core.Trace;
-import org.eclipse.pde.internal.core.ICoreConstants;
-import org.eclipse.pde.internal.core.PDECore;
import org.eclipse.pde.core.target.ITargetDefinition;
import org.eclipse.pde.core.target.ITargetPlatformService;
+import org.eclipse.pde.internal.core.ICoreConstants;
+import org.eclipse.pde.internal.core.PDECore;
import org.eclipse.pde.internal.core.util.VMUtil;
import org.eclipse.pde.internal.ui.IHelpContextIds;
import org.eclipse.pde.internal.ui.PDEUIMessages;
@@ -84,7 +84,6 @@
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
protected ITargetDefinition targetDefinition;
- protected IOSGIFrameworkWorkingCopy server2;
protected FrameworkInstanceConfiguration configuration;
private Text fNameText;
@@ -686,10 +685,9 @@
Trace.trace(Trace.SEVERE, "cannot access configuration", e);
}
- if (server != null)
- server2 = (IOSGIFrameworkWorkingCopy) server.loadAdapter(
- IOSGIFrameworkWorkingCopy.class, null);
-
+ if (server != null){
+ server.loadAdapter(IOSGIFrameworkWorkingCopy.class, null);
+ }
addChangeListener();
initialize();
}