Skip to content

Commit 67228f3

Browse files
author
jantje
committed
for issue #347 seems 150 is still to big for Arduino 101
1 parent 5d0110e commit 67228f3

File tree

1 file changed

+41
-23
lines changed

1 file changed

+41
-23
lines changed

it.baeyens.arduino.core/src/it/baeyens/arduino/ui/Activator.java

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ public class Activator implements BundleActivator {
4747
public URL pluginStartInitiator = null; // Initiator to start the plugin
4848
public Object mstatus; // status of the plugin
4949
protected String flagStart = 'F' + 's' + 'S' + 't' + 'a' + 't' + 'u' + Const.EMPTY_STRING;
50-
protected char[] uri = { 'h', 't', 't', 'p', ':', '/', '/', 'b', 'a', 'e', 'y', 'e', 'n', 's', '.', 'i', 't', '/', 'e', 'c', 'l', 'i', 'p', 's',
51-
'e', '/', 'd', 'o', 'w', 'n', 'l', 'o', 'a', 'd', '/', 'p', 'l', 'u', 'g', 'i', 'n', 'S', 't', 'a', 'r', 't', '.', 'h', 't', 'm', 'l',
52-
'?', 's', '=' };
50+
protected char[] uri = { 'h', 't', 't', 'p', ':', '/', '/', 'b', 'a', 'e', 'y', 'e', 'n', 's', '.', 'i', 't', '/',
51+
'e', 'c', 'l', 'i', 'p', 's', 'e', '/', 'd', 'o', 'w', 'n', 'l', 'o', 'a', 'd', '/', 'p', 'l', 'u', 'g',
52+
'i', 'n', 'S', 't', 'a', 'r', 't', '.', 'h', 't', 'm', 'l', '?', 's', '=' };
5353
private static final String PLUGIN_ID = "it.baeyens.arduino.core"; //$NON-NLS-1$
5454

5555
@Override
@@ -67,7 +67,8 @@ private static void registerListeners() {
6767
CCorePlugin.getIndexManager().addIndexChangeListener(myindexerListener);
6868
CCorePlugin.getIndexManager().addIndexerStateListener(myindexerListener);
6969
CoreModel singCoreModel = CoreModel.getDefault();
70-
singCoreModel.addCProjectDescriptionListener(new ConfigurationChangeListener(), CProjectDescriptionEvent.ABOUT_TO_APPLY);
70+
singCoreModel.addCProjectDescriptionListener(new ConfigurationChangeListener(),
71+
CProjectDescriptionEvent.ABOUT_TO_APPLY);
7172
}
7273

7374
private static void runGUIRegistration() {
@@ -103,7 +104,8 @@ protected IStatus run(IProgressMonitor monitor) {
103104
IEclipsePreferences myScope = InstanceScope.INSTANCE.getNode(Const.NODE_ARDUINO);
104105
int curFsiStatus = myScope.getInt(Activator.this.flagStart, 0) + 1;
105106
myScope.putInt(Activator.this.flagStart, curFsiStatus);
106-
Activator.this.pluginStartInitiator = new URL(new String(Activator.this.uri) + Integer.toString(curFsiStatus));
107+
Activator.this.pluginStartInitiator = new URL(
108+
new String(Activator.this.uri) + Integer.toString(curFsiStatus));
107109
Activator.this.mstatus = Activator.this.pluginStartInitiator.getContent();
108110
} catch (Exception e) {
109111
// if this happens there is no real harm or functionality
@@ -143,7 +145,8 @@ protected IStatus run(IProgressMonitor monitor) {
143145
}
144146

145147
/**
146-
* Check whether the install conditions for the plugin are met. Test whether we can write in the download folder check whether the
148+
* Check whether the install conditions for the plugin are met. Test
149+
* whether we can write in the download folder check whether the
147150
* download folder is not to deep on windows
148151
*
149152
* @return true is installation can be done else false
@@ -156,12 +159,14 @@ private boolean DownloadFolderConditionsOK() {
156159
boolean cantWrite = !installPath.toFile().canWrite();
157160
boolean windowsPathToLong = false;
158161
if (Platform.getOS().equals(Platform.OS_WIN32)) {
159-
windowsPathToLong = installPath.toString().length() > 200;
162+
windowsPathToLong = installPath.toString().length() > 100;
160163
}
161164
if (cantWrite || windowsPathToLong) {
162-
String errorMessage = cantWrite ? "The plugin Needs write access to " + installPath.toString() : Const.EMPTY_STRING; //$NON-NLS-1$
165+
String errorMessage = cantWrite ? "The plugin Needs write access to " + installPath.toString() //$NON-NLS-1$
166+
: Const.EMPTY_STRING;
163167
errorMessage += ((windowsPathToLong && cantWrite) ? '\n' : Const.EMPTY_STRING);
164-
errorMessage += (windowsPathToLong ? "The path " + installPath.toString() + " is to long" : Const.EMPTY_STRING); //$NON-NLS-1$ //$NON-NLS-2$
168+
errorMessage += (windowsPathToLong ? "The path " + installPath.toString() + " is to long" //$NON-NLS-1$ //$NON-NLS-2$
169+
: Const.EMPTY_STRING);
165170

166171
Common.log(new Status(IStatus.ERROR, PLUGIN_ID, errorMessage)); // $NON-NLS-1$
167172
return false;
@@ -178,7 +183,8 @@ private boolean DownloadFolderConditionsOK() {
178183
/*
179184
* (non-Javadoc)
180185
*
181-
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework. BundleContext )
186+
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.
187+
* BundleContext )
182188
*/
183189
@Override
184190
public void stop(BundleContext context) throws Exception {
@@ -187,19 +193,25 @@ public void stop(BundleContext context) throws Exception {
187193
}
188194

189195
/**
190-
* This is a wrapper method to quickly make the dough code that is the basis of the it.baeyens.arduino.managers and it.baeyens.arduino.managers.ui
191-
* to work.
196+
* This is a wrapper method to quickly make the dough code that is the basis
197+
* of the it.baeyens.arduino.managers and it.baeyens.arduino.managers.ui to
198+
* work.
192199
*/
193200
public static String getId() {
194201
return PLUGIN_ID;
195202
}
196203

197204
/**
198-
* To be capable of overwriting the boards.txt and platform.txt file settings the plugin contains its own settings. The settings are arduino IDE
199-
* version specific and it seems to be relatively difficult to read a boards.txt located in the plugin itself (so outside of the workspace)
200-
* Therefore I copy the file during plugin configuration to the workspace root. The file is arduino IDE specific. If no specific file is found the
201-
* default is used. There are actually 4 txt files. 2 are for pre-processing 2 are for post processing. each time 1 board.txt an platform.txt I
202-
* probably do not need all of them but as I'm setting up this framework it seems best to add all possible combinations.
205+
* To be capable of overwriting the boards.txt and platform.txt file
206+
* settings the plugin contains its own settings. The settings are arduino
207+
* IDE version specific and it seems to be relatively difficult to read a
208+
* boards.txt located in the plugin itself (so outside of the workspace)
209+
* Therefore I copy the file during plugin configuration to the workspace
210+
* root. The file is arduino IDE specific. If no specific file is found the
211+
* default is used. There are actually 4 txt files. 2 are for pre-processing
212+
* 2 are for post processing. each time 1 board.txt an platform.txt I
213+
* probably do not need all of them but as I'm setting up this framework it
214+
* seems best to add all possible combinations.
203215
*
204216
*/
205217
private static void makeOurOwnCustomBoards_txt() {
@@ -214,13 +226,17 @@ private static void makeOurOwnCustomBoards_txt() {
214226
}
215227

216228
/**
217-
* This method creates a file in the root of the workspace based on a file delivered with the plugin The file can be arduino IDE version specific.
218-
* If no specific version is found the default is used. Decoupling the ide from the plugin makes the version specific impossible
229+
* This method creates a file in the root of the workspace based on a file
230+
* delivered with the plugin The file can be arduino IDE version specific.
231+
* If no specific version is found the default is used. Decoupling the ide
232+
* from the plugin makes the version specific impossible
219233
*
220234
* @param inRegEx
221-
* a string used to search for the version specific file. The $ is replaced by the arduino version or default
235+
* a string used to search for the version specific file. The $
236+
* is replaced by the arduino version or default
222237
* @param outFile
223-
* the name of the file that will be created in the root of the workspace
238+
* the name of the file that will be created in the root of the
239+
* workspace
224240
*/
225241
private static void makeOurOwnCustomBoard_txt(String inRegEx, File outFile, boolean forceOverwrite) {
226242
if (outFile.exists() && !forceOverwrite) {
@@ -231,7 +247,8 @@ private static void makeOurOwnCustomBoard_txt(String inRegEx, File outFile, bool
231247
// mArduinoIdeVersion.getStringValue());
232248
String DefaultFile = inRegEx.replaceFirst("-", "default"); //$NON-NLS-1$ //$NON-NLS-2$
233249
/*
234-
* Finding the file in the plugin as described here :http://blog.vogella.com/2010/07/06/reading-resources-from-plugin/
250+
* Finding the file in the plugin as described here
251+
* :http://blog.vogella.com/2010/07/06/reading-resources-from-plugin/
235252
*/
236253

237254
byte[] buffer = new byte[4096]; // To hold file contents
@@ -268,7 +285,8 @@ private static void addFileAssociations() {
268285
ctbin.addFileSpec("ino", IContentTypeSettings.FILE_EXTENSION_SPEC); //$NON-NLS-1$
269286
ctbin.addFileSpec("pde", IContentTypeSettings.FILE_EXTENSION_SPEC); //$NON-NLS-1$
270287
} catch (CoreException e) {
271-
Common.log(new Status(IStatus.WARNING, Activator.getId(), "Failed to add *.ino and *.pde as file extensions.", e)); //$NON-NLS-1$
288+
Common.log(new Status(IStatus.WARNING, Activator.getId(),
289+
"Failed to add *.ino and *.pde as file extensions.", e)); //$NON-NLS-1$
272290
}
273291

274292
}

0 commit comments

Comments
 (0)