processing.app.Platform Java Examples

The following examples show how to use processing.app.Platform. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RLangEditor.java    From Processing.R with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Get the reference from web, not local.
 * 
 * @see processing.app.ui.Editor#handleFindReference()
 */
@Override
protected void handleFindReference() {
  String ref = referenceCheck(true);
  if (ref != null) {
    // Remove _.
    if (ref.charAt(ref.length() - 1) == '_') {
      ref = ref.substring(0, ref.length() - 1);
    }
    // Get the reference from the home page, not in local.
    String item = new String(Constant.PROCESSINGR_URL + Constant.REFERENCE_NAME + ref + ".html");
    Platform.openURL(item);
  } else {
    String text = textarea.getSelectedText().trim();
    if (text.length() == 0) {
      statusNotice(Language.text("editor.status.find_reference.select_word_first"));
    } else {
      statusNotice(Language.interpolate("editor.status.find_reference.not_available", text));
    }
  }
}
 
Example #2
Source File: PdeSketch.java    From Processing.R with GNU General Public License v3.0 6 votes vote down vote up
public PdeSketch(final Sketch sketch, final File sketchPath, final DisplayType displayType,
    final Point location, final LocationType locationType) {

  this.displayType = displayType;
  this.location = location;
  this.locationType = locationType;

  this.mainFile = sketchPath.getAbsoluteFile();
  this.mainCode = sketch.getMainProgram();
  this.sketchHome = sketch.getFolder().getAbsoluteFile();
  this.realSketchPath = sketchPath;

  final String[] codeFileNames = new String[sketch.getCodeCount()];
  for (int i = 0; i < codeFileNames.length; i++) {
    codeFileNames[i] = sketch.getCode(i).getFile().getName();
  }
  this.codeFileNames = codeFileNames;

  final List<File> libraryDirs = new ArrayList<>();
  libraryDirs.add(Platform.getContentFile("modes/java/libraries"));
  libraryDirs.add(Base.getSketchbookLibrariesFolder());
  libraryDirs.add(sketchPath);
  this.libraryDirs = libraryDirs;
}
 
Example #3
Source File: APDE.java    From APDE with GNU General Public License v2.0 5 votes vote down vote up
public void initProcessingPrefs() {
	if (processingPrefsInitialized) {
		// Don't do this again
		return;
	}
	
	//Make pde.jar behave properly
	
	//Set up the Processing-specific folder
	final File dir = getDir("processing_home", 0);
	
	if (!dir.exists()) {
		dir.mkdir();
		
		//Put the default preferences file where Processing will look for it
		EditorActivity.copyAssetFolder(getAssets(), "processing-default", dir.getAbsolutePath());
	}
	
	//Some magic to put our own platform in place
	AndroidPlatform.setDir(dir);
	
	try {
		Field inst = Platform.class.getDeclaredField("inst");
		inst.setAccessible(true);
		inst.set(null, new AndroidPlatform());
	} catch (Exception e) {
		e.printStackTrace();
	}
	
	processingPrefsInitialized = true;
}