Skip to content

Commit 2d92d3c

Browse files
committed
More warnings fixed
1 parent 72cd6b0 commit 2d92d3c

File tree

16 files changed

+609
-978
lines changed

16 files changed

+609
-978
lines changed

it.baeyens.arduino.common/src/it/baeyens/arduino/common/InstancePreferences.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ public static void setOpenSerialWithMonitor(boolean value) {
3232
setGlobalValue(KEY_OPEN_SERIAL_WITH_MONITOR, value);
3333
}
3434

35+
/**
36+
* Give back the user option if the libraries need to be added or not
37+
*
38+
* @return true if libraries need to be added else false.
39+
*/
3540
public static boolean getAutomaticallyIncludeLibraries() {
3641
return getGlobalBoolean(KEY_AUTO_IMPORT_LIBRARIES, true);
3742
}

it.baeyens.arduino.core/src/it/baeyens/arduino/actions/OpenSerialMonitorHandler.java

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,16 @@
2121
import org.eclipse.ui.PartInitException;
2222
import org.eclipse.ui.PlatformUI;
2323

24+
import it.baeyens.arduino.common.Common;
2425
import it.baeyens.arduino.common.Const;
2526
import it.baeyens.arduino.common.InstancePreferences;
26-
import it.baeyens.arduino.common.Common;
2727
import it.baeyens.arduino.listeners.ProjectExplorerListener;
2828

2929
/**
30-
* This is a handler to connect the plugin.xml to the code for opening the
31-
* serial monitor
30+
* This is a handler to connect the plugin.xml to the code for opening the serial monitor
3231
*
3332
*
34-
* The code looks for all selected projects for the com port and the baudrate
35-
* and connects if they both are found
33+
* The code looks for all selected projects for the com port and the baudrate and connects if they both are found
3634
*
3735
* @author jan
3836
*
@@ -43,8 +41,7 @@ public class OpenSerialMonitorHandler extends AbstractHandler {
4341
public Object execute(ExecutionEvent event) throws ExecutionException {
4442
try {
4543

46-
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
47-
.showView("it.baeyens.arduino.monitor.views.SerialMonitor"); //$NON-NLS-1$
44+
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("it.baeyens.arduino.monitor.views.SerialMonitor"); //$NON-NLS-1$
4845
// find all projects
4946
IProject SelectedProjects[] = ProjectExplorerListener.getSelectedProjects();
5047
// if there are project selected and the autoConnectScope feature is
@@ -53,8 +50,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
5350
for (IProject curproject : SelectedProjects) {
5451
int baud = getBaudRate(curproject);
5552
if (baud > 0) {
56-
String comPort = Common.getBuildEnvironmentVariable(curproject,
57-
Const.ENV_KEY_JANTJE_COM_PORT, "");
53+
String comPort = Common.getBuildEnvironmentVariable(curproject, Const.ENV_KEY_JANTJE_COM_PORT, Const.EMPTY_STRING);
5854
if (!comPort.isEmpty()) {
5955
it.baeyens.arduino.monitor.SerialConnection.add(comPort, baud);
6056
}
@@ -68,20 +64,18 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
6864
}
6965

7066
/**
71-
* given a project look in the source code for the line of code that sets
72-
* the baud rate on the board Serial.begin([baudRate]);
67+
* given a project look in the source code for the line of code that sets the baud rate on the board Serial.begin([baudRate]);
7368
*
7469
*
7570
*
76-
* return the integer value of [baudrate] or in case of error a negative
77-
* value
71+
* return the integer value of [baudrate] or in case of error a negative value
7872
*
7973
* @param iProject
8074
* @return
8175
*/
82-
private int getBaudRate(IProject iProject) {
83-
String setupFunctionName = "setup";
84-
String serialVariable = "Serial.begin";
76+
private static int getBaudRate(IProject iProject) {
77+
String setupFunctionName = "setup"; //$NON-NLS-1$
78+
String serialVariable = "Serial.begin"; //$NON-NLS-1$
8579

8680
ICProject curProject = CoreModel.getDefault().getCModel().getCProject(iProject.getName());
8781

@@ -90,8 +84,7 @@ private int getBaudRate(IProject iProject) {
9084
index = CCorePlugin.getIndexManager().getIndex(curProject);
9185
index.acquireReadLock();
9286
// find bindings for name
93-
IIndexBinding[] bindings = index.findBindings(setupFunctionName.toCharArray(), IndexFilter.ALL_DECLARED,
94-
new NullProgressMonitor());
87+
IIndexBinding[] bindings = index.findBindings(setupFunctionName.toCharArray(), IndexFilter.ALL_DECLARED, new NullProgressMonitor());
9588
ICPPFunction setupFunc = null;
9689
for (IIndexBinding curbinding : bindings) {
9790
if (curbinding instanceof ICPPFunction) {
@@ -113,12 +106,11 @@ private int getBaudRate(IProject iProject) {
113106
String SetupFileContent = FileUtils.readFileToString(new File(SetupFileName));
114107
int serialBeginStart = SetupFileContent.indexOf(serialVariable);
115108
if (serialBeginStart != -1) {
116-
int serialBeginStartbraket = SetupFileContent.indexOf("(", serialBeginStart);
109+
int serialBeginStartbraket = SetupFileContent.indexOf("(", serialBeginStart); //$NON-NLS-1$
117110
if (serialBeginStartbraket != -1) {
118-
int serialBeginCloseBraket = SetupFileContent.indexOf(")", serialBeginStartbraket);
111+
int serialBeginCloseBraket = SetupFileContent.indexOf(")", serialBeginStartbraket); //$NON-NLS-1$
119112
if (serialBeginCloseBraket != -1) {
120-
String baudrate = SetupFileContent.substring(serialBeginStartbraket + 1, serialBeginCloseBraket)
121-
.trim();
113+
String baudrate = SetupFileContent.substring(serialBeginStartbraket + 1, serialBeginCloseBraket).trim();
122114
return Integer.parseInt(baudrate);
123115
}
124116
}

it.baeyens.arduino.core/src/it/baeyens/arduino/core/builder/inoToCpp.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@ class SampleDeltaVisitor implements IResourceDeltaVisitor {
1818
/*
1919
* (non-Javadoc)
2020
*
21-
* @see
22-
* org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.
23-
* core.resources.IResourceDelta)
21+
* @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse. core.resources.IResourceDelta)
2422
*/
23+
@Override
2524
public boolean visit(IResourceDelta delta) throws CoreException {
2625
IResource resource = delta.getResource();
2726
if (resource.getFileExtension() != null) {
28-
if (resource.getFileExtension().equalsIgnoreCase("ino")
29-
|| resource.getFileExtension().equalsIgnoreCase("pde")) {
27+
if (resource.getFileExtension().equalsIgnoreCase("ino") //$NON-NLS-1$
28+
|| resource.getFileExtension().equalsIgnoreCase("pde")) { //$NON-NLS-1$
3029
try {
3130
PdePreprocessor.processProject(getProject());
3231
} catch (CoreException e) {
@@ -39,16 +38,13 @@ public boolean visit(IResourceDelta delta) throws CoreException {
3938
}
4039
}
4140

42-
public static final String BUILDER_ID = "it.baeyens.arduino.core.inoToCpp";
43-
4441
/*
4542
* (non-Javadoc)
4643
*
47-
* @see org.eclipse.core.internal.events.InternalBuilder#build(int,
48-
* java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
44+
* @see org.eclipse.core.internal.events.InternalBuilder#build(int, java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
4945
*/
50-
protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args, IProgressMonitor monitor)
51-
throws CoreException {
46+
@Override
47+
protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args, IProgressMonitor monitor) throws CoreException {
5248
if (kind == FULL_BUILD) {
5349
fullBuild(monitor);
5450
} else {
@@ -62,12 +58,13 @@ protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args, IPr
6258
return null;
6359
}
6460

61+
@Override
6562
protected void clean(IProgressMonitor monitor) throws CoreException {
6663
// delete markers set and files created
6764

6865
}
6966

70-
protected void fullBuild(final IProgressMonitor monitor) throws CoreException {
67+
protected void fullBuild(final IProgressMonitor monitor) {
7168
try {
7269
PdePreprocessor.processProject(getProject());
7370
} catch (CoreException e) {

it.baeyens.arduino.core/src/it/baeyens/arduino/listeners/IndexerListener.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class IndexerListener implements IIndexChangeListener, IIndexerStateListe
2121

2222
@Override
2323
public void indexChanged(IIndexChangeEvent event) {
24-
ChangedProjects.add(event.getAffectedProject().getProject());
24+
this.ChangedProjects.add(event.getAffectedProject().getProject());
2525

2626
}
2727

@@ -30,11 +30,11 @@ public void indexChanged(IIndexerStateEvent event) {
3030

3131
if (event.indexerIsIdle()) {
3232
if (InstancePreferences.getAutomaticallyIncludeLibraries()) {
33-
for (IProject curProject : ChangedProjects) {
33+
for (IProject curProject : this.ChangedProjects) {
3434
Libraries.checkLibraries(curProject);
3535
}
3636
}
37-
ChangedProjects.clear();
37+
this.ChangedProjects.clear();
3838
}
3939
}
4040

0 commit comments

Comments
 (0)