ICEcoder objectThere is a single ICEcoder object and everything resides within it, variables and functions. There are also a number of settings within, followed by the functions themselves.
- setLayout(setEditor (bool))
Sets the layout of the page again, especially useful after you modify the size of an element. Pass false as the setEditor argument to not resize the editor pane.
- setSplitPane(onOff (string))
Switch between single or split pane (editor and diff editor). Pass "on" as the onOff argument to show diff pane and "off" to remove it.
- toolShowHideToggle(tool (string))
This toggle slides in/out of view the tool you request. The tool can be "terminal", "output", "database" or "git".
- changeFilesW(expandContract (string))
Pass an argument of "expand" or "contract" to respectively expand or contract the file manager.
Calling this will toggle between locking & unlocking the file manager.
- showHidePlugins(vis (string))
Show or hide the plugin panel strip. The vis argument can be "show" or "hide".
Undo the last text edit change for focused editor pane.
Redo the last text edit change for focused editor pane.
- indent(moreLess (string))
Indent the highlighted text more or less. The moreLess argument can be "more" or "less".
- moveLines(dir (string))
Move the line the cursor is on or selected text in an up or down direction if possible. The dir argument can be "up" or "down".
- highlightLine(line (int))
Will select the given line argument value.
- focus(diff (bool))
Focus on the editor pane. The diff argument is a bool and if true, will focus on the diff pane.
- goToLine(lineNo, charNo, noFocus (int, int, bool))
Will place the cursor on a line and also character if provided in the first 2 arguments. If no line or character is provided it will set the cursor according to the value in the Go to Line textfield. If true is passed for the noFocus argument the editor won't be focused on, false means it will.
Comment or uncomment the current line or text selection.
- addLineBreakAtEnd(line (int - optional))
Adds a <br> tag the end of the line. If line is not passed as an argument, it will add to the end of the line the cursor resides on.
- insertLineBefore(line (int - optional))
Insert a line before and auto-indent. If line is not passed as an argument, it will add it before the line the cursor resides on.
- insertLineAfter(line (int - optional))
Insert a line after and auto-indent. If line is not passed as an argument, it will add it after the line the cursor resides on.
- duplicateLines(line (int - optional))
If line argument value is passed, it will duplicate that line. If not passed, it will duplicate the line the cursor is on, or if text is highlighted, that text.
- removeLines(line (int - optional))
If line argument value is passed, it will remove that line. If not passed, it will duplicate the line the cursor is on, or if text is highlighted, that text.
Will try to move the cursor to the function or class definition for the string the cursor is currently on. Will attempt to find it through a number of common definition formats.
- fmAction(evt, action (object, string))
The evt should be an object or array with ctrlKey or shiftKey bool property to mimic that key being down/up. String can be "up" or "down" to move the single selection in the file manager up/down. You can also use "left" to contract dir and "right" or "enter" to expand dir if it's a dir, or open file if it's a file.
- selectDeselectFile(dir, load (object, bool))
You can pass the DOM elem for a dir as the dir argument and true as the load argument to load children and expand to show them, or false to contract the dir and remove children.
- isFileFolder(ref (string))
The ref argument should be a string of the relative path for a dir/file as per the DOM elems id value. It will return "folder" if it's a dir, "file" if a file and false if not found.
- selectDeselectFile(action, file (string, string))
The action argument can be either "select" or "deselect" and the relative dir/file as per the DOM elems id value can be passed in the 2nd argument and will select/deselect as per 1st argument.
Remove selection from all dirs/files.
Starts a new tab and prompts for a filename, saving it immediately.
Prompts for a folder name then creates a dir with that name and path on the server.
- openFile(fileLink (string))
When called without an argument it will open the file selected in the file manager (if a single file is selected). If the fileLink argument is passed as a relative path, it will open that file.
Opens a dialog prompt asking user for file path or remote URL to open.
- getRemoteFile(remoteFile (string))
Gets the remote URL as per the remoteFile argument and opens in a new tab.
- saveFile(saveAs (bool))
When called without an argument, it will save the current document. If a true is passed for the saveAs argument, it will prompt the user for a filename and save as that.
- renameFile(oldName, newName (string - optional, string - optional))
Renames the dir/file in oldName argument as newName argument. Both should be relative paths. You can omit oldName and it will use the selected file. You can omit newName and it will prompt.
- moveFile(oldName, newName (string, string))
Moves the dir/file in oldName argument to newName argument. Both should be relative paths. You can omit oldName and it will use the selected file. You can omit newName and it will prompt.
- deleteFiles(fileList (string - optional))
The fileList argument can be a new line (\n) seperated list of paths to delete. If not passed, it will use selected dirs/files as the list. It will show a confirm prompt before deleting.
- copyFiles(fileList (array))
The fileList argument here should be an array of dir/file paths. It will note these as the dirs/files you wish to copy in a subsequent paste action.
- pasteFiles(location (string))
If you have a list of dirs/files noted to be copied, you can call this function with a location relative path and it will paste them at that path or show a message if unable, or nothing to paste.
- duplicateFiles(fileList (array))
Pass an array as the fileList of relative dir/file paths and it will duplicate those with a (num) postfix in the file name.
- uploadFileSelect(location (string))
Displays the multiple file select dialog for user to select files they wish to upload, which will uploaded to the location argument. Should be a dir.
- showHideFileNav(vis, elem (string, string))
The vis argument should be "show" or "hide" and the elem argument should be "optionsFile", "optionsEdit", "optionsSettings" or "optionsHelp" to show/hide options for that nav menu display.
- isPathFolder(path (string))
The path argument should be a relative path and it will consult the file manager display, returning true if it's a dir, false if it's a file.
- checkExists(pah (string))
Makes a call to the server to check if a dir/file exists. If you have raw/object/both set for "File Details Output" in ICEcoder settings it will output that in the console. You can also get to the data in object form after it's checked at ICEcoder.lastFileDirCheckStatusObj.
Show the file manager context menu. The position of the menu will depend on the ICEcoder.mouseX and ICEcoder.mouseY variables and the options shown depend on the dir(s)/file(s) selected.
Hides the file manager context menu.
- updateFileManagerList(action, location, file, perms, oldName, uploaded, fileOrFolder (string, string, string, int - optional, string - optional, bool - optional, string))
Updates the file manager according to given arguments. action can be "add", "rename", "move", "chmod" or "delete". location is the relative path of the target. file is the filename only, perms are the permissions to set. oldName is the current name (used when renaming). uploaded indicates if the file has just been uploaded. fileOrFolder should be "file" or "folder".
Reloads the file manager.
find & replace
- findReplace(find, selectNext, canActionChanges, findPrevious (string, bool, bool, bool))
Actions a find according to the UI selections made in the find & replace builder. find should be a string to look for. If selectNext is true, it will highlight the next occurance from the cursor position. If canActionChanges is true and there is a replace string to use, it will action. If findPrevious is true it will move in reverse, selecting the previous occurance from cursor position.
- replaceInFile(fileRef, find, replace (string, string, string))
Replaces find argument with replace argument in fileRef argument, which should be a relative path.
info & display
- showDisplay(show (string))
The show argument can be "byte" to show the byte count or "char" to show the cursors line & character position, in bottom right corner of editor.
- showHide(doVis, elem (string, object))
Call this function with doVis set as "show" or "hide" and the DOM elem you'd like to show or hide as the 2nd argument. This will set the CSS visibility property on the element as visible or hidden respectively.
- getcMInstance(tab (int - optional))
This will return the DOM object for the CodeMirror instance for the focused editor, or for the tab number given. Now you have all of the CodeMirror API available to you. For example ICEcoder.getCMInstance().setValue('New content') to set the content. Full CodeMirror API can be found at codemirror.net.
- getcMdiffInstance(tab (int - optional))
This will return the DOM object for the CodeMirror instance for the diff pane of the focused editor, or for the tab number given. Now you have all of the CodeMirror API available to you. For example ICEcoder.getCMdiffInstance().setValue('New content in diff pane') to set the content. Full CodeMirror API can be found at codemirror.net.
Call this to get the users absolute mouse X & Y positions. These values are stored in ICEcoder.mouseX and ICEcoder.mouseY.
- serverMessage(message (string - optional))
Messages are shown at the bottom left under the code editor as an indication to the user of server related events that are in progress. The message argument should be short and HTML is accepted, so you can style what is displayed. Calling this function without a message argument will clear the message.
- showColorPicker(color (string - optional))
Show the color picker on screen. You can pass a hex value as color to set that color in the picker on open.
- fMIconVis(icon, vis (string, decimal))
Change the CSS opacity of icon to the vis value.
- isOpen(file (string))
Check if the document in the file argument is open in the ICEcoder.openFiles array (ie, open as a tab in ICEcoder).
Return the CodeMirror instance for the focused editor pane. Now you have all of the CodeMirror API available to you. For example ICEcoder.getThisCM().setValue('New content in focused pane') to set the content for the currently focused editor pane. Full CodeMirror API can be found at codemirror.net.
Switch code assist on/off.
- serverQueue(action, item, file, changes (string, string, string, string - optional))
The server queue is where all interaction with the server begins. This means you can call many operations and they will be dealt with in turn to avoid jams or unexpected results. The action argument should be either "add" or "delete" to add to the end of the queue or delete from the front. The item argument should be a file control process currently used as standard by ICEcoder. The file argument should be the path to the file and if it's a save action the changes argument should be the tuple data of changes to apply on file on server.
This will perform a window.stop call, remove everything but the running task from the server queue, hide the loading screen and show a server message to the user that tasks are being cancelled.
Set the current previousFiles array in the settings file.
- settingsScreen(hide, tab (bool, string - optional))
Call this function with false as the hide argument and it will show the settings screen. You can also pass a tab argument of "general", "style", "accounts" or "security" and it will jump to that tab when it's displayed.
Show the help screen.
Show the backup versions screen.
Show the ICEcoder manual.
- propertiesScreen(fileName (string))
Show the properties screen for the given fileName relative path.
Show the plugins manager screen.
This will switch between full screen and standard view when called.
- chmod(file, perms (string, int))
Set the perms argument on the file argument path.
Opens the current document as a new window to view as a webpage. Created as a named child window so live editing is possible.
Log out of ICEcoder.
- outputMsg(msg (string))
Send text to the output pane. Can be HTML.
- message(msg (string))
Alert the msg argument.
- ask(question (string))
Confirm the question argument.
- getInput(question, defaultValue (string, string))
Prompt the user with a question and show the defaultValue argument as the initial answer.
- dataMessage(message (string))
Show a message on the data screen (seen when no tabs are open).
- viewTutorial(step (bool/int))
Display the ICEcoder tutorial. Pass false as the step argument to start from the beginning, or a number (from 1 to 11) to show that section. 99 will close the tutorial.
- switchTab(newTab, noFocus (int, bool))
Call this function with a newTab argument to indicate the tab to switch to, starts at 1 on the left. You can pass true as the noFocus argument to not focus on editor after switching tab.
- newTab(autoSave) (bool - optional)
Adds a new empty tab. If you pass true as the autoSave argument, it will prompt for a file path to save to as well.
Cycle to the next tab to the right or loop back to the first tab.
Cycle to the next tab to the left or loop back to the last tab.
- closeTab(closeTabNum, dontSetPV, dontAsk (int, bool - optional, bool - optional))
Closes tab at the given closeTabNum argument, starting from 1 on the left. Add true as dontSetPV argument to not update previously opened files array and true as dontAsk to not ask the user if they wish to close the tab, which may happen otherwise.
Closes all open tabs, uses closeTab to close tabs sequentially from right to left.
- sortTabs(newOrder (array))
Call this and pass through an array of tab numbers as newOrder to sort into that order. If you have 3 tabs open you could say pass [3,1,2] as newOrder.
Sorts tabs into alphabetical order by filename.