Difference between revisions of "Orion/Documentation/User Guide/Getting started"
(→Searching for file content)
(→Finding a file by name)
|Line 140:||Line 140:|
===Finding a file by name===
===Finding a file by name===
The '''Find File Named''' dialog can be opened by pressing '''Ctrl+Shift+F''' on your keyboard. This dialog lets you search for a file by name. Simple wildcard characters are supported
The '''Find File Named''' dialog can be opened by pressing '''Ctrl+Shift+F''' on your keyboard. This dialog lets you search for a file by name. Simple wildcard characters are supported.
[[Image:Orion-.png|Open resource dialog]]
===Searching inside the editor===
===Searching inside the editor===
Revision as of 14:42, 19 June 2013
This tutorial will get you started with using Orion, and provides a step by step walk-through of some of the core functionality.
- 1 Getting Orion
- 2 Logging into Orion
- 3 Working with folders and files
- 4 Editing code
- 5 Searching
- 6 Working with git
- 7 Launching your project as a website
- 8 Extending Orion
You have two choices to get started with Orion. The first is to create an account on the public server at OrionHub. To do this, visit OrionHub, click Create a new account and enter your information. An email will be sent to confirm your address. Once confirmed, return to OrionHub and log in.
The second method to get started is to download a standalone version of the server. For instructions, see Install Orion on Localhost.
Once you have successfully set up an account, you can proceed to the next step.
Logging into Orion
When you attempt to access a page that requires logging in, you'll be redirected to the Login Page and prompted for credentials.
On your first visit to the login page, you can sign in using either of these ways:
- Sign in using a Mozilla Persona. To do this, your Persona email address must be the same as the email address you chose when creating your Orion account. You can sign up for a Persona here.
Later on, after you've logged into Orion and linked a Google account to your Orion account, you'll be able to sign in with Google:
- Sign in with a linked Google account. To link a Google account, use Orion's Settings page.
If you are accessing a server other than OrionHub or localhost, the server administrator may have disallowed you from creating an account on the Login Page. In that case, you'll have to ask the server administrator to create one for you.
After a successful login, you will be redirected back to the page you came from.
Working with folders and files
In Orion, each user has a virtual root folder where various folders and files can be created. These files are maintained on the Orion server. The Navigator page is used to browse and modify your files.
Creating folders and files
Once you've successfully logged into Orion, make sure you're at the Navigator page by clicking Navigator in the banner at the top of any page. This is where your files and folders will be shown. Because you haven't created any files or folders yet, the navigator is initially empty.
To start working with files and folders in Orion, create a folder using the New > Folder action in the navigator toolbar:
To navigate the files, you can either expand the folders (using the ► twisties), or you can click on the folder's name to drill into that folder. After you have drilled into a folder, you can use the breadcrumb at the top of the page, or your browser's Back button, or a keyboard command (Alt+↑) to navigate back up the tree.
The banner provides access to common operations in Orion. The main navigation links appear at the top left of the page banner, next to the Orion logo. The right side of the banner provides a user options menu containing Settings, Help, and other commonly used actions. Underneath, the page header describes the title of the page, the breadcrumb, and the name of the resource being manipulated. On the right of the page header are items that let you quickly find and mark pages that you commonly use. The star icon allows you to mark the current folder (or in general, the resource you're currently viewing) as a favorite. The search box allows you to quickly search the contents of the current folder. Next to the search box is the search options menu, which lets you set advanced options such as regular expression search and access saved searches. The Related pages menu lets you quickly navigate to another Orion page relevant to the folder you're viewing (for example, if you're viewing a folder inside a Git repository, you can navigate straight to the Git Log page for the folder).
Below the banner, the content of the page appears. The page toolbar contains commands. The New File and New Folder act on the current folder (unless you've made a selection in the file tree).
Commands that apply to an individual file or folder are located in the Actions menu next to the item in the navigator.
Files and folders may be selected by clicking their row, or by using the Ctrl and arrow keys on the keyboard. Once a selection has been made, commands that operate on the selected items (such as move, copy, and delete) will be available in the Actions menu.
Importing folders and files
There are many ways to import your files into Orion. You can upload a zip file, import via SFTP, or clone a Git repository.
To import files from your local file system into Orion, select one or more files on your computer and drag them on to the Import dialog:
The dialog only accepts files, not folders, so to import a folder, you'll have to zip it first. Then drag the .zip file into the dialog, ensuring that the Unzip *.zip files option is checked, and the contents of the zip file will appear in your folder in the navigator, like this:
Exporting folders and files
When you have worked with your code on Orion and are ready to export your work back to your local workstation, navigate to the folder you wish to export and choose the Export as Zip link.
The contents of the folder will be placed in a zip file, and that zip file will be downloaded using your browser's download manager.
You can use the Favorites icon in the page header or the favorites menu item to bookmark a folder or file in your navigator. A link to this folder or file will appear in your favorites list and can be used to navigate quickly to that file or folder.
Favorites are also suggested as move/copy targets.
They also appear in the Find File dialog.
Once you've navigated to the file you want to work with, click on its link to open the Coding page. You'll find that the editor supports the basics (cut/copy/paste, undo/redo) as well as your favorite text-editing features from Eclipse desktop (move up/down, copy up/down, go to line, find, incremental find). For now, most of these commands are accessible only through keyboard shortcuts, using the default key bindings in Eclipse desktop. To see a full list of available keyboard commands in the editor, press Alt+Shift+? (Ctrl+Shift+? on Mac OS). Outside of the editor, you can get the same help on any page by pressing Shift+?.
The editor will also match brackets when you click next to a bracket, perform auto indention, and provide source-code oriented key bindings for things like toggling comments and adding/removing block comments.
The Orion server is Firebug-savvy, so that recent alpha versions of Firebug, together with a Firebug extension, can invoke the Orion editor to make corrections. For details about this, see the Firebug wiki.
Syntax highlighting of CSS files is also supported. Orion uses CSSLint to validate and check for problems in CSS files. An outline view is also provided, which shows the list of rules in your file and allows you to quickly navigate between them. As a proof of concept, Orion provides a very simple form of content assist. In Orion, our goal is to provide the plug-in points for things like content assist and outlining, allowing plug-in developers to enhance the functionality. For now, Orion supplies a content assist based on CSS keyword proposals. We hope to integrate existing source code analysis tools as plug-ins to enhance content assist support, outlining, and problem identification for many kinds of files.
A simple HTML outline is provided, based on DOM ids. Syntax highlighting is also available for HTML files.
Extending the editor with a Plug-in
We've also implemented pluggable editor actions which allow third-party developers to extend the behavior of the Orion editor on the fly. For example, we've developed an Orion plug-in based on the JSBeautifier code formatter so that source code can be easily beautified. The plug-in is located at http://mamacdon.github.com/0.5/plugins/beautify/jsbeautify.html. Once the plug-in is installed, reload an Orion editor to see a new command appear beside rest of the editor commands.
Once you are actively using Orion, you'll find that you want to move quickly between different files and folders. There are several ways to go about this. Orion uses Apache Lucene search to provide several different search functions.
Searching for file content
The search page is designed to perform a search for content inside your files. The scope of the search depends on how you open the search page. There are 3 ways to open the search page with a search scope.
- In any Orion page, clicking on the [Navigation Menu][Main Pages][Search] link will bring up the search page with the global scope. The search page will search all the files without a scope.
- In the pages that contain the current directory information(e.g., the navigator and editor page), clicking on [Navigation Menu][Related Links][Scope Search] link will bring up the search page with the current directory as the scope. The search page will then search all the files under the directory.
- In the navigator pages with a single directory selected, clicking on [Actions][Scope Search] link will bring up the search page with the selected directory as the scope. The search page will then search all the files under the selected directory.
Once the Search page is loaded, you can start to search on all criteria available on the left hand side of the page. The search result is displayed on the right hand side.
Finding a file by name
The Find File Named dialog can be opened by pressing Ctrl+Shift+F on your keyboard. This dialog lets you search for a file by name. Simple wildcard characters are supported.
Searching inside the editor
You can also perform a global search on a highlighted phrase from inside the editor using the Ctrl + H shortcut.
A nice side effect of editing source code in browser pages is being able to use browser mechanisms, such as the history, to quickly find files. If you find yourself working in the same handful of files, opening a new browser tab and typing in the filename will quickly get you there.
Working with git
We intend to provide many different kinds of plug-ins for integrating Orion into open source and proprietary version control systems. Our first example in this area is a UI for working with Git repositories. For files and folders that are managed in a Git repository, you will see a menu allowing you to navigate to various Git views dealing with the file or folder:
The Related pages menu will also give you contextually appropriate links to various Git pages, including the top-level of your Git repository.
The Git Status page shows you all the files in your git repository that have changed, and allows you to stage, unstage, and commit changes. You can multi-select files to stage/unstage/commit using shift or ctrl.
Click the twistie arrow next to a changed file to show a comparison of what changed in the file.
If you prefer, you can view the changes in a side-by-side comparison:
The Git Status page shows also a list of recent commits on the active branch. You may open the Git Log page by clicking the Complete Log button and see the full list of commits on that branch. Click on a commit in the log page to open the Git Commit page for complete information about that commit.
You can also open the Compare page for each change in the selected commit.
Launching your project as a website
Orion can create "sites" for testing an application developed with Orion as a stand-alone website. Click the Sites link on the Orion toolbar. This takes you to the Sites page, where you can create, edit, delete, or launch web sites for testing. Sites will be launched either as a sub-domain of the Orion server, or at an alternate IP address when running the server locally.
Note that if you are running your own server, and you wish to set up hosting on a sub-domain, a different IP address, or if you're running Mac OS X, you'll have to supply some more information to the Orion server. See Configuring virtual host names for more detail.
You create a site by clicking the Create Site button and supplying a name for your site. Your new site will appear and you should fill in the path mappings for your project. In this example the "My Work" project has an index.html in the root so just a basic path is required to mount that project at the root. Once done that step you select "Save". You have the option of starting the server from this page or refreshing the list of sites page to see your new site.
Assuming you are at the sites page you can click the Start button to start the site. The result will be similar to the following image, showing the site running and the URL showing where the site can be accessed.
Upon visiting the site's URL, success! — We see the listing of the "My Work" directory we added.
Now browse to index.html:
At this point, we can do incremental development by using the Orion editor to change the files in our "My Work" folder, and then simply reloading the site page to see the changes.
Orion allows developers to build plug-ins that add behavior to Orion pages. Let's learn about plug-ins by taking a look at a simple plug-in which extends the navigator.
To see what plug-ins are installed in your Orion system, open the Settings page from the Options menu at the top right of the Orion banner (next to the user name). Then click the Plugins category on the left-hand side of the screen.
The Plugins page shows what plug-ins you have installed, and allows you to install, reload, or remove plugins. You can see that several plugins that provide Orion functionality, such as file management, user management, Git, JSLint, are already installed. Plugins extend Orion by implementing new behaviors, or extensions to the system. Places where "extensions" may be contributed are often called extension points.
The orion.navigate.command extension point allows plug-ins to contribute commands that act upon files and folders in the navigator. These commands will be placed in the Actions menu. Each contributed command can specify how many and what types of files it can work with.
A sample plug-in that demonstrates the different kinds of commands you can contribute is located at http://orionhub.org/plugins/sampleCommandsPlugin.html. On the Plugins page, you can click on Install and paste or type this URL into the text area and press Submit. When you reload the Navigator page, you will see new commands in the item action menu.
The "Bulk item command" can act on more than one item, so it will appear in the Actions menu when you select more than one item in the navigator.