//////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2010, 2026 Contributors to the Eclipse Foundation
//
// See the NOTICE file(s) distributed with this work for additional
// information regarding copyright ownership.
//
// This program and the accompanying materials are made available
// under the terms of the MIT License which is available at
// https://opensource.org/licenses/MIT
//
// SPDX-License-Identifier: MIT
//////////////////////////////////////////////////////////////////////////////

include::_part_attributes.asciidoc[]

:leveloffset: -2

[[use-edit-exec]]
== Editing files and executing commands

This section contains information on <<use-edit,editing text files>> and <<use-commands,executing commands>> (such as starting a simulator).

indexterm:[edit,file]
indexterm:[file,edit]
indexterm:[edit,text]
indexterm:[text,edit]
indexterm:[editor,text]
indexterm:[text,editor]
indexterm:[editor,file]
indexterm:[file,editor]
indexterm:[editor,warning]
indexterm:[warning,editor]
indexterm:[editor,error]
indexterm:[error,editor]
indexterm:[editor,marker]
indexterm:[marker,editor]

[[use-edit]]
=== Editing a text file

To edit a file, double click it in the _Project explorer_ or _Package explorer_ <<use-terminology-view,view>>.

Whenever you open a text file, change it, or the editor receives the focus, the file is checked for errors.
If there are errors (or warnings), they are displayed in the editor as shown below.

image::{use-imgsdir}/model_with_error.png[]

Note that you can hover over an error in the source code itself to find out what the problem is.
Alternatively, you can hover over the error marker in the margin of the editor, or look at the _Problems_ view.
Also, if a file has an error or a warning, an overlay icon is shown in the _Project Explorer_ and _Package Explorer_ views, for that file, the directories that contain it, and the <<use-terminology-project,project>> that contains it.

Normally, text files are opened with their associated text editor that features syntax highlighting, and syntax and type checking.
Large files are however opened with the default non-language-specific text editor to avoid performance issues.
You can open a file in an editor of your choosing by right clicking it and selecting menu:Open With[] and then selecting the editor of your choosing, or choosing menu:Other...[] to open a dialog to choose from a larger selection of editors.

indexterm:[command,execute]
indexterm:[execute,command]
indexterm:[file,right click]
indexterm:[right click,file]
indexterm:[simulate]

[[use-commands]]
=== Executing commands

If you have a file without errors, you can execute certain commands on it.
The various Eclipse ESCET tools add _commands_ to Eclipse.
For instance, CIF models can be simulated using a simulation command.

To execute a command on a file, right click the file in the _Project Explorer_ or _Package Explorer_ <<use-terminology-view,view>>, and select the command.
Alternatively, if you have the file open in an editor, right click the editor, and select the command.

The commands that are available are determined by the file extension of the file.
That is, only the commands applicable for a certain file are shown.

Besides simulation, other commands may be available, depending on the modeling language and tools you use.
Consult the specific documentation for each tool for more details.
