Skip to content

Commit a54995b

Browse files
author
jantje
committed
#671 extended the message
Also made it the same message for upload/build/import source/ Fixed some warnings
1 parent f7354eb commit a54995b

File tree

14 files changed

+491
-494
lines changed

14 files changed

+491
-494
lines changed

io.sloeber.core/src/cc/arduino/packages/ssh/SCP.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ public void sendFile(File localFile, String remoteFile) throws IOException {
116116
out.write(("C0644 " + localFile.length() + " " + remoteFile + "\n").getBytes());
117117
ensureAcknowledged();
118118

119+
@SuppressWarnings("resource")
119120
FileInputStream fis = null;
120121
try {
121122
fis = new FileInputStream(localFile);

io.sloeber.core/src/io/sloeber/core/Activator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import io.sloeber.core.managers.Manager;
4040

4141
abstract class FamilyJob extends Job {
42-
static final String MY_FAMILY = "myJobFamily";
42+
static final String MY_FAMILY = "myJobFamily"; //$NON-NLS-1$
4343

4444
public FamilyJob(String name) {
4545
super(name);

io.sloeber.core/src/io/sloeber/core/api/Sketch.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,23 @@
3232
import io.sloeber.core.common.IndexHelper;
3333
import io.sloeber.core.tools.Helpers;
3434
import io.sloeber.core.tools.Libraries;
35+
import io.sloeber.core.tools.uploaders.Messages;
3536
import io.sloeber.core.tools.uploaders.UploadSketchWrapper;
3637

3738
public class Sketch {
3839
// preference nodes
3940
public static final String NODE_ARDUINO = Activator.NODE_ARDUINO;
4041

4142
public static void upload(IProject project) {
43+
try {
44+
if (project == null || !project.hasNature(Const.ARDUINO_NATURE_ID)) {
45+
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID, Messages.Upload_no_arduino_sketch, null));
46+
return;
47+
}
48+
} catch (CoreException e) {
49+
// Log the Exception
50+
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID, Messages.Upload_Project_nature_unaccesible, e));
51+
}
4252
Display.getDefault().asyncExec(new Runnable() {
4353
@Override
4454
public void run() {

io.sloeber.core/src/io/sloeber/core/toolchain/ArduinoGnuMakefileGenerator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2193,6 +2193,7 @@ private IManagedCommandLineInfo generateToolCommandLineInfo(ITool tool, String s
21932193
* @param enumeratedOutputs
21942194
* vector of the filenames that are the output of this rule
21952195
*/
2196+
@SuppressWarnings("null")
21962197
protected void addRuleForSource(String relativePath, StringBuffer buffer, IResource resource, IPath sourceLocation,
21972198
IResourceInfo rcInfo, boolean generatedSource, List<IPath> generatedDepFiles,
21982199
List<IPath> enumeratedOutputs) {

io.sloeber.core/src/io/sloeber/core/tools/uploaders/UploadSketchWrapper.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import org.eclipse.core.resources.IFile;
66
import org.eclipse.core.resources.IProject;
7-
import org.eclipse.core.runtime.CoreException;
87
import org.eclipse.core.runtime.IProgressMonitor;
98
import org.eclipse.core.runtime.IStatus;
109
import org.eclipse.core.runtime.Path;
@@ -51,17 +50,6 @@ static public void upload(IProject Project, String cConf) {
5150

5251
public void internalUpload(IProject Project, String cConf) {
5352

54-
// Check that we have a AVR Project
55-
try {
56-
if (Project == null || !Project.hasNature(Const.ARDUINO_NATURE_ID)) {
57-
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID, Messages.Upload_no_arduino_sketch, null));
58-
return;
59-
}
60-
} catch (CoreException e) {
61-
// Log the Exception
62-
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID, Messages.Upload_Project_nature_unaccesible, e));
63-
}
64-
6553
String UpLoadTool = Common.getBuildEnvironmentVariable(Project, cConf,
6654
Common.get_ENV_KEY_TOOL(Const.ACTION_UPLOAD), Const.EMPTY_STRING);
6755
String MComPort = Common.getBuildEnvironmentVariable(Project, cConf, Const.ENV_KEY_JANTJE_UPLOAD_PORT,

io.sloeber.ui/src/io/sloeber/ui/ImportLibraries.java

Lines changed: 146 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -22,156 +22,156 @@
2222
* when opened and on the perform finish. This import wizard uses 3 folders to
2323
* import: The arduino library folder Your 3rd party library folder and the
2424
* Arduino library folder of your hardware
25-
*
25+
*
2626
* @author Jan Baeyens
2727
* @see performFinish
28-
*
28+
*
2929
*/
3030
public class ImportLibraries implements IImportWizard {
3131

32-
private Import_Libraries_Page mProjectSelectionPage;
33-
private IWizardPage[] mPages;
34-
private IWizardContainer mWizardContainer = null;
35-
36-
private static String mPageName = Messages.ui_select;
37-
private static String mPageTitle = Messages.ui_select_Arduino_libraries;
38-
39-
@Override
40-
public void init(IWorkbench arg0, IStructuredSelection selection) {
41-
// Entry point is here when right-click project and import -- as opposed
42-
// to AddLibraryAction.execute() when done via Arduino menu
43-
}
44-
45-
@Override
46-
public void addPages() {
47-
48-
// Always create the pages like this at the last minute
49-
50-
IProject theProject = null;
51-
IProject SelectedProjects[] = ProjectExplorerListener.getSelectedProjects();
52-
53-
if (SelectedProjects.length > 0) {
54-
theProject = SelectedProjects[0];
55-
this.mProjectSelectionPage = new Import_Libraries_Page(theProject, mPageName, StructuredSelection.EMPTY);
56-
this.mProjectSelectionPage.setWizard(this);
57-
this.mPages = new IWizardPage[1];
58-
this.mPages[0] = this.mProjectSelectionPage;
59-
} else {
60-
61-
Activator.log(new Status(IStatus.ERROR, Activator.getId(), Messages.error_no_Arduino_project_selected));
62-
}
63-
}
64-
65-
@Override
66-
public boolean canFinish() {
67-
return true;
68-
}
69-
70-
@Override
71-
public void createPageControls(Composite pageContainer) {// no code needed
72-
73-
}
74-
75-
@Override
76-
public void dispose() {// no code needed
77-
}
78-
79-
@Override
80-
public IWizardContainer getContainer() {
81-
return this.mWizardContainer;
82-
}
83-
84-
@Override
85-
public Image getDefaultPageImage() {
86-
return null;
87-
}
88-
89-
@Override
90-
public IDialogSettings getDialogSettings() {
91-
return null;
92-
}
93-
94-
@Override
95-
public IWizardPage getNextPage(IWizardPage arg0) {
96-
for (int i = 0; i < (this.mPages.length - 1); i++) {
97-
if (arg0 == this.mPages[i]) {
98-
return this.mPages[i + 1];
99-
}
100-
}
101-
return null;
102-
}
103-
104-
@Override
105-
public IWizardPage getPage(String pageName) {
106-
for (int i = 0; i < this.mPages.length; i++) {
107-
if (pageName == this.mPages[i].getName())
108-
return this.mPages[i];
109-
}
110-
return null;
111-
}
112-
113-
@Override
114-
public int getPageCount() {
115-
return this.mPages.length;
116-
}
117-
118-
@Override
119-
public IWizardPage[] getPages() {
120-
return this.mPages;
121-
}
122-
123-
@Override
124-
public IWizardPage getPreviousPage(IWizardPage arg0) {
125-
for (int i = 1; i < this.mPages.length; i++) {
126-
if (arg0 == this.mPages[i])
127-
return this.mPages[i - 1];
128-
}
129-
return null;
130-
}
131-
132-
@Override
133-
public IWizardPage getStartingPage() {
134-
return this.mPages[0];
135-
}
136-
137-
@Override
138-
public RGB getTitleBarColor() {
139-
return null;
140-
}
141-
142-
@Override
143-
public String getWindowTitle() {
144-
return mPageTitle;
145-
}
146-
147-
@Override
148-
public boolean isHelpAvailable() {
149-
return false;
150-
}
151-
152-
@Override
153-
public boolean needsPreviousAndNextButtons() {
154-
return false;
155-
}
156-
157-
@Override
158-
public boolean needsProgressMonitor() {
159-
return false;
160-
}
161-
162-
@Override
163-
public boolean performCancel() {
164-
return true;
165-
}
166-
167-
@Override
168-
public boolean performFinish() {
169-
return this.mProjectSelectionPage.PerformFinish();
170-
}
171-
172-
@Override
173-
public void setContainer(IWizardContainer wizardContainer) {
174-
this.mWizardContainer = wizardContainer;
175-
}
32+
private Import_Libraries_Page mProjectSelectionPage;
33+
private IWizardPage[] mPages;
34+
private IWizardContainer mWizardContainer = null;
35+
36+
private static String mPageName = Messages.ui_select;
37+
private static String mPageTitle = Messages.ui_select_Arduino_libraries;
38+
39+
@Override
40+
public void init(IWorkbench arg0, IStructuredSelection selection) {
41+
// Entry point is here when right-click project and import -- as opposed
42+
// to AddLibraryAction.execute() when done via Arduino menu
43+
}
44+
45+
@Override
46+
public void addPages() {
47+
48+
// Always create the pages like this at the last minute
49+
50+
IProject theProject = null;
51+
IProject SelectedProjects[] = ProjectExplorerListener.getSelectedProjects();
52+
53+
if (SelectedProjects.length > 0) {
54+
theProject = SelectedProjects[0];
55+
this.mProjectSelectionPage = new Import_Libraries_Page(theProject, mPageName, StructuredSelection.EMPTY);
56+
this.mProjectSelectionPage.setWizard(this);
57+
this.mPages = new IWizardPage[1];
58+
this.mPages[0] = this.mProjectSelectionPage;
59+
} else {
60+
61+
Activator.log(new Status(IStatus.ERROR, Activator.getId(), Messages.Handler_No_project_found));
62+
}
63+
}
64+
65+
@Override
66+
public boolean canFinish() {
67+
return true;
68+
}
69+
70+
@Override
71+
public void createPageControls(Composite pageContainer) {// no code needed
72+
73+
}
74+
75+
@Override
76+
public void dispose() {// no code needed
77+
}
78+
79+
@Override
80+
public IWizardContainer getContainer() {
81+
return this.mWizardContainer;
82+
}
83+
84+
@Override
85+
public Image getDefaultPageImage() {
86+
return null;
87+
}
88+
89+
@Override
90+
public IDialogSettings getDialogSettings() {
91+
return null;
92+
}
93+
94+
@Override
95+
public IWizardPage getNextPage(IWizardPage arg0) {
96+
for (int i = 0; i < (this.mPages.length - 1); i++) {
97+
if (arg0 == this.mPages[i]) {
98+
return this.mPages[i + 1];
99+
}
100+
}
101+
return null;
102+
}
103+
104+
@Override
105+
public IWizardPage getPage(String pageName) {
106+
for (int i = 0; i < this.mPages.length; i++) {
107+
if (pageName == this.mPages[i].getName())
108+
return this.mPages[i];
109+
}
110+
return null;
111+
}
112+
113+
@Override
114+
public int getPageCount() {
115+
return this.mPages.length;
116+
}
117+
118+
@Override
119+
public IWizardPage[] getPages() {
120+
return this.mPages;
121+
}
122+
123+
@Override
124+
public IWizardPage getPreviousPage(IWizardPage arg0) {
125+
for (int i = 1; i < this.mPages.length; i++) {
126+
if (arg0 == this.mPages[i])
127+
return this.mPages[i - 1];
128+
}
129+
return null;
130+
}
131+
132+
@Override
133+
public IWizardPage getStartingPage() {
134+
return this.mPages[0];
135+
}
136+
137+
@Override
138+
public RGB getTitleBarColor() {
139+
return null;
140+
}
141+
142+
@Override
143+
public String getWindowTitle() {
144+
return mPageTitle;
145+
}
146+
147+
@Override
148+
public boolean isHelpAvailable() {
149+
return false;
150+
}
151+
152+
@Override
153+
public boolean needsPreviousAndNextButtons() {
154+
return false;
155+
}
156+
157+
@Override
158+
public boolean needsProgressMonitor() {
159+
return false;
160+
}
161+
162+
@Override
163+
public boolean performCancel() {
164+
return true;
165+
}
166+
167+
@Override
168+
public boolean performFinish() {
169+
return this.mProjectSelectionPage.PerformFinish();
170+
}
171+
172+
@Override
173+
public void setContainer(IWizardContainer wizardContainer) {
174+
this.mWizardContainer = wizardContainer;
175+
}
176176

177177
}

0 commit comments

Comments
 (0)