public OpenAction(EditTextPageModel theModel) {

		OpenPages pages = theModel.getOpenPages();
		System.out.println(pages.size() + "pages");
		File fileToOpen = getOpenedFile();
		
		
		if(fileToOpen!=null){
			
			Scanner scan;
			try {
				scan = new Scanner(new FileReader(fileToOpen));
				String allText="";
				while(scan.hasNext()){
					allText = allText + scan.next() + " ";
					
				}
				String[] docText = allText.split("(@PAGE)\\d@\\s");
				
				for(int i = 1; i <docText.length;i++){
					
					if(i>pages.size()){
						theModel.addPage(docText[i]);
					}
					else{
						pages.get(i-1).setText(docText[i]);
					}
				}
				
			} 
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
			
		}
		else{
			
		}
	}