plugins/de.uni_jena.iaa.linktype.atomic.atomical/src/main/java/org/corpus_tools/atomic/console/parser/ConsoleCommandParser.java
public static class AddOrDeleteEdgeCommandContext extends CommandContext {
	public Token cmd;
	public Token type;
	public Token source;
	public Token target;
	public QnameContext anno;
	public Token value;
	public List<TerminalNode> STR() { return getTokens(ConsoleCommandParser.STR); }
	public TerminalNode STR(int i) {
		return getToken(ConsoleCommandParser.STR, i);
	}
	public TerminalNode TYPE_STR() { return getToken(ConsoleCommandParser.TYPE_STR, 0); }
	public QnameContext qname() {
		return getRuleContext(QnameContext.class,0);
	}
	public AddOrDeleteEdgeCommandContext(CommandContext ctx) { copyFrom(ctx); }
	@Override
	public void enterRule(ParseTreeListener listener) {
		if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).enterAddOrDeleteEdgeCommand(this);
	}
	@Override
	public void exitRule(ParseTreeListener listener) {
		if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).exitAddOrDeleteEdgeCommand(this);
	}
}
plugins/de.uni_jena.iaa.linktype.atomic.atomical/src/main/java/org/corpus_tools/atomic/console/parser/ConsoleCommandParser.java
public static class Anno_argsContext extends ParserRuleContext {
	public QnameContext anno;
	public Token value;
	public QnameContext qname() {
		return getRuleContext(QnameContext.class,0);
	}
	public TerminalNode STR() { return getToken(ConsoleCommandParser.STR, 0); }
	public Anno_argsContext(ParserRuleContext parent, int invokingState) {
		super(parent, invokingState);
	}
	@Override public int getRuleIndex() { return RULE_anno_args; }
	@Override
	public void enterRule(ParseTreeListener listener) {
		if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).enterAnno_args(this);
	}
	@Override
	public void exitRule(ParseTreeListener listener) {
		if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).exitAnno_args(this);
	}
}
plugins/org.corpus-tools.atomic/src/main/java/org/corpus_tools/atomic/api/editors/DocumentGraphEditor.java
public abstract class DocumentGraphEditor extends EditorPart {
	
	private static final Logger log = LogManager.getLogger(DocumentGraphEditor.class);


	/**
	 * The default name for {@link SaltProject} serialization files.
	 */
	public static final String SALT_PROJECT_FILE_NAME = "saltProject.salt";
	
	
	protected SDocumentGraph graph = null;


	protected boolean dirty;


	private boolean isValidInput = true;
	
	
	/* (non-Javadoc)
	 * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
	 */
	@Override
	public void doSave(IProgressMonitor monitor) {
		IPath resPath = ((FileEditorInput) getEditorInput()).getPath();
		SaltUtil.saveDocumentGraph(getGraph(), URI.createFileURI(resPath.toOSString()));
		
		this.dirty = false;
		firePropertyChange(EditorPart.PROP_DIRTY);

	}

	/* (non-Javadoc)
	 * @see org.eclipse.ui.part.EditorPart#doSaveAs()
	 */
	@Override
	public void doSaveAs() {	
//		IPath origResPath = ((FileEditorInput) getEditorInput()).getPath();
//		FileDialog dlg = new FileDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
//		// use the folder of the current file as argument
//		dlg.setFilterPath(origResPath.toFile().getParent());
//		dlg.setFilterExtensions(new String[] {"*.salt", "*.*"});
//		String path = dlg.open();
//		if(path != null) {
//			SaltUtil.saveDocumentGraph(getGraph(), URI.createFileURI(path));
//			
//			this.dirty = false;
//			firePropertyChange(EditorPart.PROP_DIRTY);
//		}
	}

	/** 
	 * Handles initialization of the editor.
	 * 
	 * Clients should check against {@link #isInputValid()} after calling
	 * `super.init(site, input)` in order to catch any exceptions that
	 * may occur when the initialization is aborted (e.g., due to the
	 * user trying to open a Salt project file with a document editor
	 * extending this class).
	 * 
	 * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
	 */
	@Override
	public void init(IEditorSite site, IEditorInput input) throws PartInitException {
		// Site and input must be set in init
		setSite(site);
		setInput(input);
		
		if (!(input instanceof FileEditorInput)) {
			log.error("Input for editors of type {} must be of type {}, but the provided input is of type {}!", this.getClass().getName(), FileEditorInput.class.getName(), input.getClass().getName(), new AtomicGeneralException());
		}
		else {
			String filePath = ((FileEditorInput) input).getPath().makeAbsolute().toOSString();
			log.trace("Input for editor {} is file '{}'.", this.getClass().getName(), filePath);
			if (filePath.endsWith(SALT_PROJECT_FILE_NAME)) {
				MessageDialog.openInformation(Display.getDefault().getActiveShell(), "Cannot open project file", "This editor does work only on Salt document files, but you have tried to open a Salt project file (\"" + SALT_PROJECT_FILE_NAME + "\").\n\nClosing editor.");
				isValidInput = false;
				Display.getDefault().asyncExec(new Runnable() {
					@Override
					public void run() {
						getSite().getPage().closeEditor(DocumentGraphEditor.this, false); 
					}
				});
				log.info("Attempt to open editor for Salt documents (" + this.getClass().getSimpleName() + ") with Salt project file aborted.");
				return;
			}
			IProject iProject = ((FileEditorInput) input).getFile().getProject();
			IFile saltProjectResource = null;
			try {
				for (IResource member : iProject.members()) {
					if (member instanceof IFile && member.getName().equalsIgnoreCase(SALT_PROJECT_FILE_NAME)) { // FIXME Externalize and treat for case, etc
						saltProjectResource = (IFile) member;
					}
				}
			}
			catch (CoreException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			String projectFilePath = saltProjectResource.getRawLocation().toOSString();
			SaltProject saltProject = SaltFactory.createSaltProject();
			saltProject.loadCorpusStructure(URI.createFileURI(projectFilePath));
			for (SDocument doc : saltProject.getCorpusGraphs().get(0).getDocuments()) {
				if (doc.getDocumentGraphLocation().equals(URI.createFileURI(filePath))) {
					doc.loadDocumentGraph();
					graph = doc.getDocumentGraph();
				}
			}
			log.trace("Loaded document graph {}.", graph);
			
			// Set name of editor
			setPartName(((FileEditorInput) input).getPath().lastSegment());
			// Set up editor for automatic context switches on activation/deactivation 
			PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().addPartListener(new PartContextListener(site.getId(), site.getPluginId()));
		}
	}

	/* (non-Javadoc)
	 * @see org.eclipse.ui.part.EditorPart#isDirty()
	 */
	@Override
	public boolean isDirty() {
		return dirty;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
	 */
	@Override
	public boolean isSaveAsAllowed() {
		// TODO Auto-generated method stub
		return false;
	}

	/** 
	 * Simply passes the parent argument to an abstract method which
	 * clients need to override to create a control for this
	 * editor part.
	 * 
	 * **Note:** Clients should not override this method, albeit its
	 * visibility. Instead, they should override the method 
	 * {@link #createEditorPartControl(Composite)}!
	 * 
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
	 */
	@Override
	public void createPartControl(Composite parent) {
		createEditorPartControl(parent);
	}

	/**
	 * TODO: Description
	 *
	 * @param parent
	 */
	public abstract void createEditorPartControl(Composite parent);

//	/* (non-Javadoc)
//	 * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
//	 */
//	@Override
//	public void setFocus() {
//		// TODO Auto-generated method stub
//
//	}

	/**
	 * Returns the single instance of {@link SDocumentGraph} that
	 * the editor can work on. The graph is initially set in {@link #init(IEditorSite, IEditorInput)}
	 * and the referenced object itself should not be changed anywhere 
	 * in the editor.
	 * 
	 * @return the graph
	 */
	public final SDocumentGraph getGraph() {
		return graph;
	}

	/**
	 * @param dirty the dirty to set
	 */
	public final void setDirty(boolean dirty) {
		this.dirty = dirty;
		firePropertyChange(PROP_DIRTY);
	}

	/**
	 * @return the isValidInput
	 */
	public final boolean isInputValid() {
		return isValidInput;
	}
	
	@Override
	public void setFocus() {
		/*
		 * Empty implementation here prevents forced
		 * implementation down the inheritance line
		 * but can still be overridden to provide
		 * customized implementations.
		 */
	}

}
plugins/de.uni_jena.iaa.linktype.atomic.atomical/src/main/java/org/corpus_tools/atomic/console/parser/ConsoleCommandBaseListener.java
public class ConsoleCommandBaseListener implements ConsoleCommandListener {
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void enterCommandChain(ConsoleCommandParser.CommandChainContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void exitCommandChain(ConsoleCommandParser.CommandChainContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void enterAnnotateCommand(ConsoleCommandParser.AnnotateCommandContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void exitAnnotateCommand(ConsoleCommandParser.AnnotateCommandContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void enterNewStructureNodeCommand(ConsoleCommandParser.NewStructureNodeCommandContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void exitNewStructureNodeCommand(ConsoleCommandParser.NewStructureNodeCommandContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void enterNewSpanNodeCommand(ConsoleCommandParser.NewSpanNodeCommandContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void exitNewSpanNodeCommand(ConsoleCommandParser.NewSpanNodeCommandContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void enterDeleteElementCommand(ConsoleCommandParser.DeleteElementCommandContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void exitDeleteElementCommand(ConsoleCommandParser.DeleteElementCommandContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void enterAddOrDeleteEdgeCommand(ConsoleCommandParser.AddOrDeleteEdgeCommandContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void exitAddOrDeleteEdgeCommand(ConsoleCommandParser.AddOrDeleteEdgeCommandContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void enterHelpCommand(ConsoleCommandParser.HelpCommandContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void exitHelpCommand(ConsoleCommandParser.HelpCommandContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void enterClearCommand(ConsoleCommandParser.ClearCommandContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void exitClearCommand(ConsoleCommandParser.ClearCommandContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void enterAnno_args(ConsoleCommandParser.Anno_argsContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void exitAnno_args(ConsoleCommandParser.Anno_argsContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void enterQname(ConsoleCommandParser.QnameContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void exitQname(ConsoleCommandParser.QnameContext ctx) { }

	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void enterEveryRule(ParserRuleContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void exitEveryRule(ParserRuleContext ctx) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void visitTerminal(TerminalNode node) { }
	/**
	 * {@inheritDoc}
	 *
	 * <p>The default implementation does nothing.</p>
	 */
	@Override public void visitErrorNode(ErrorNode node) { }
}
plugins/de.uni_jena.iaa.linktype.atomic.atomical/src/main/java/org/corpus_tools/atomic/console/parser/ConsoleCommandParser.java
public static class NewSpanNodeCommandContext extends CommandContext {
	public Token cmd;
	public Token STR;
	public List<Token> elements = new ArrayList<Token>();
	public Anno_argsContext anno_args() {
		return getRuleContext(Anno_argsContext.class,0);
	}
	public List<TerminalNode> STR() { return getTokens(ConsoleCommandParser.STR); }
	public TerminalNode STR(int i) {
		return getToken(ConsoleCommandParser.STR, i);
	}
	public NewSpanNodeCommandContext(CommandContext ctx) { copyFrom(ctx); }
	@Override
	public void enterRule(ParseTreeListener listener) {
		if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).enterNewSpanNodeCommand(this);
	}
	@Override
	public void exitRule(ParseTreeListener listener) {
		if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).exitNewSpanNodeCommand(this);
	}
}
plugins/de.uni_jena.iaa.linktype.atomic.atomical/src/main/java/org/corpus_tools/atomic/console/parser/ConsoleCommandParser.java
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class ConsoleCommandParser extends Parser {
	static { RuntimeMetaData.checkVersion("4.6", RuntimeMetaData.VERSION); }

	protected static final DFA[] _decisionToDFA;
	protected static final PredictionContextCache _sharedContextCache =
		new PredictionContextCache();
	public static final int
		T__0=1, T__1=2, TYPE_STR=3, NEWLINE=4, STR=5, WS=6;
	public static final int
		RULE_start = 0, RULE_command = 1, RULE_anno_args = 2, RULE_qname = 3;
	public static final String[] ruleNames = {
		"start", "command", "anno_args", "qname"
	};

	private static final String[] _LITERAL_NAMES = {
		null, "':'", "'::'"
	};
	private static final String[] _SYMBOLIC_NAMES = {
		null, null, null, "TYPE_STR", "NEWLINE", "STR", "WS"
	};
	public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);

	/**
	 * @deprecated Use {@link #VOCABULARY} instead.
	 */
	@Deprecated
	public static final String[] tokenNames;
	static {
		tokenNames = new String[_SYMBOLIC_NAMES.length];
		for (int i = 0; i < tokenNames.length; i++) {
			tokenNames[i] = VOCABULARY.getLiteralName(i);
			if (tokenNames[i] == null) {
				tokenNames[i] = VOCABULARY.getSymbolicName(i);
			}

			if (tokenNames[i] == null) {
				tokenNames[i] = "<INVALID>";
			}
		}
	}

	@Override
	@Deprecated
	public String[] getTokenNames() {
		return tokenNames;
	}

	@Override

	public Vocabulary getVocabulary() {
		return VOCABULARY;
	}

	@Override
	public String getGrammarFileName() { return "ConsoleCommand.g4"; }

	@Override
	public String[] getRuleNames() { return ruleNames; }

	@Override
	public String getSerializedATN() { return _serializedATN; }

	@Override
	public ATN getATN() { return _ATN; }

	public ConsoleCommandParser(TokenStream input) {
		super(input);
		_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
	}
	public static class StartContext extends ParserRuleContext {
		public StartContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_start; }
	 
		public StartContext() { }
		public void copyFrom(StartContext ctx) {
			super.copyFrom(ctx);
		}
	}
	public static class CommandChainContext extends StartContext {
		public TerminalNode EOF() { return getToken(ConsoleCommandParser.EOF, 0); }
		public CommandContext command() {
			return getRuleContext(CommandContext.class,0);
		}
		public TerminalNode NEWLINE() { return getToken(ConsoleCommandParser.NEWLINE, 0); }
		public List<TerminalNode> WS() { return getTokens(ConsoleCommandParser.WS); }
		public TerminalNode WS(int i) {
			return getToken(ConsoleCommandParser.WS, i);
		}
		public CommandChainContext(StartContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).enterCommandChain(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).exitCommandChain(this);
		}
	}

	public final StartContext start() throws RecognitionException {
		StartContext _localctx = new StartContext(_ctx, getState());
		enterRule(_localctx, 0, RULE_start);
		int _la;
		try {
			_localctx = new CommandChainContext(_localctx);
			enterOuterAlt(_localctx, 1);
			{
			{
			setState(8);
			command();
			setState(12);
			_errHandler.sync(this);
			_la = _input.LA(1);
			while (_la==WS) {
				{
				{
				setState(9);
				match(WS);
				}
				}
				setState(14);
				_errHandler.sync(this);
				_la = _input.LA(1);
			}
			setState(15);
			match(NEWLINE);
			}
			setState(17);
			match(EOF);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class CommandContext extends ParserRuleContext {
		public CommandContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_command; }
	 
		public CommandContext() { }
		public void copyFrom(CommandContext ctx) {
			super.copyFrom(ctx);
		}
	}
	public static class NewStructureNodeCommandContext extends CommandContext {
		public Token cmd;
		public Token STR;
		public List<Token> elements = new ArrayList<Token>();
		public Anno_argsContext anno_args() {
			return getRuleContext(Anno_argsContext.class,0);
		}
		public List<TerminalNode> STR() { return getTokens(ConsoleCommandParser.STR); }
		public TerminalNode STR(int i) {
			return getToken(ConsoleCommandParser.STR, i);
		}
		public NewStructureNodeCommandContext(CommandContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).enterNewStructureNodeCommand(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).exitNewStructureNodeCommand(this);
		}
	}
	public static class DeleteElementCommandContext extends CommandContext {
		public Token cmd;
		public Token STR;
		public List<Token> elements = new ArrayList<Token>();
		public List<TerminalNode> STR() { return getTokens(ConsoleCommandParser.STR); }
		public TerminalNode STR(int i) {
			return getToken(ConsoleCommandParser.STR, i);
		}
		public DeleteElementCommandContext(CommandContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).enterDeleteElementCommand(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).exitDeleteElementCommand(this);
		}
	}
	public static class AddOrDeleteEdgeCommandContext extends CommandContext {
		public Token cmd;
		public Token type;
		public Token source;
		public Token target;
		public QnameContext anno;
		public Token value;
		public List<TerminalNode> STR() { return getTokens(ConsoleCommandParser.STR); }
		public TerminalNode STR(int i) {
			return getToken(ConsoleCommandParser.STR, i);
		}
		public TerminalNode TYPE_STR() { return getToken(ConsoleCommandParser.TYPE_STR, 0); }
		public QnameContext qname() {
			return getRuleContext(QnameContext.class,0);
		}
		public AddOrDeleteEdgeCommandContext(CommandContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).enterAddOrDeleteEdgeCommand(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).exitAddOrDeleteEdgeCommand(this);
		}
	}
	public static class HelpCommandContext extends CommandContext {
		public Token cmd;
		public TerminalNode STR() { return getToken(ConsoleCommandParser.STR, 0); }
		public HelpCommandContext(CommandContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).enterHelpCommand(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).exitHelpCommand(this);
		}
	}
	public static class ClearCommandContext extends CommandContext {
		public Token cmd;
		public TerminalNode STR() { return getToken(ConsoleCommandParser.STR, 0); }
		public ClearCommandContext(CommandContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).enterClearCommand(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).exitClearCommand(this);
		}
	}
	public static class AnnotateCommandContext extends CommandContext {
		public Token cmd;
		public Token STR;
		public List<Token> elements = new ArrayList<Token>();
		public QnameContext anno;
		public Token value;
		public List<TerminalNode> STR() { return getTokens(ConsoleCommandParser.STR); }
		public TerminalNode STR(int i) {
			return getToken(ConsoleCommandParser.STR, i);
		}
		public QnameContext qname() {
			return getRuleContext(QnameContext.class,0);
		}
		public AnnotateCommandContext(CommandContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).enterAnnotateCommand(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).exitAnnotateCommand(this);
		}
	}
	public static class NewSpanNodeCommandContext extends CommandContext {
		public Token cmd;
		public Token STR;
		public List<Token> elements = new ArrayList<Token>();
		public Anno_argsContext anno_args() {
			return getRuleContext(Anno_argsContext.class,0);
		}
		public List<TerminalNode> STR() { return getTokens(ConsoleCommandParser.STR); }
		public TerminalNode STR(int i) {
			return getToken(ConsoleCommandParser.STR, i);
		}
		public NewSpanNodeCommandContext(CommandContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).enterNewSpanNodeCommand(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).exitNewSpanNodeCommand(this);
		}
	}

	public final CommandContext command() throws RecognitionException {
		CommandContext _localctx = new CommandContext(_ctx, getState());
		enterRule(_localctx, 2, RULE_command);
		int _la;
		try {
			int _alt;
			setState(69);
			_errHandler.sync(this);
			switch ( getInterpreter().adaptivePredict(_input,7,_ctx) ) {
			case 1:
				_localctx = new AnnotateCommandContext(_localctx);
				enterOuterAlt(_localctx, 1);
				{
				setState(19);
				if (!("a".equals(getCurrentToken().getText()))) throw new FailedPredicateException(this, "\"a\".equals(getCurrentToken().getText())");
				setState(20);
				((AnnotateCommandContext)_localctx).cmd = match(STR);
				setState(22); 
				_errHandler.sync(this);
				_alt = 1;
				do {
					switch (_alt) {
					case 1:
						{
						{
						setState(21);
						((AnnotateCommandContext)_localctx).STR = match(STR);
						((AnnotateCommandContext)_localctx).elements.add(((AnnotateCommandContext)_localctx).STR);
						}
						}
						break;
					default:
						throw new NoViableAltException(this);
					}
					setState(24); 
					_errHandler.sync(this);
					_alt = getInterpreter().adaptivePredict(_input,1,_ctx);
				} while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER );
				setState(26);
				((AnnotateCommandContext)_localctx).anno = qname();
				setState(27);
				match(T__0);
				setState(29);
				_errHandler.sync(this);
				_la = _input.LA(1);
				if (_la==STR) {
					{
					setState(28);
					((AnnotateCommandContext)_localctx).value = match(STR);
					}
				}

				}
				break;
			case 2:
				_localctx = new NewStructureNodeCommandContext(_localctx);
				enterOuterAlt(_localctx, 2);
				{
				setState(31);
				if (!("n".equals(getCurrentToken().getText()))) throw new FailedPredicateException(this, "\"n\".equals(getCurrentToken().getText())");
				setState(32);
				((NewStructureNodeCommandContext)_localctx).cmd = match(STR);
				setState(36);
				_errHandler.sync(this);
				_alt = getInterpreter().adaptivePredict(_input,3,_ctx);
				while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
					if ( _alt==1 ) {
						{
						{
						setState(33);
						((NewStructureNodeCommandContext)_localctx).STR = match(STR);
						((NewStructureNodeCommandContext)_localctx).elements.add(((NewStructureNodeCommandContext)_localctx).STR);
						}
						} 
					}
					setState(38);
					_errHandler.sync(this);
					_alt = getInterpreter().adaptivePredict(_input,3,_ctx);
				}
				setState(39);
				anno_args();
				}
				break;
			case 3:
				_localctx = new NewSpanNodeCommandContext(_localctx);
				enterOuterAlt(_localctx, 3);
				{
				setState(40);
				if (!("s".equals(getCurrentToken().getText()))) throw new FailedPredicateException(this, "\"s\".equals(getCurrentToken().getText())");
				setState(41);
				((NewSpanNodeCommandContext)_localctx).cmd = match(STR);
				setState(43); 
				_errHandler.sync(this);
				_alt = 1;
				do {
					switch (_alt) {
					case 1:
						{
						{
						setState(42);
						((NewSpanNodeCommandContext)_localctx).STR = match(STR);
						((NewSpanNodeCommandContext)_localctx).elements.add(((NewSpanNodeCommandContext)_localctx).STR);
						}
						}
						break;
					default:
						throw new NoViableAltException(this);
					}
					setState(45); 
					_errHandler.sync(this);
					_alt = getInterpreter().adaptivePredict(_input,4,_ctx);
				} while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER );
				setState(47);
				anno_args();
				}
				break;
			case 4:
				_localctx = new DeleteElementCommandContext(_localctx);
				enterOuterAlt(_localctx, 4);
				{
				setState(48);
				if (!("d".equals(getCurrentToken().getText()))) throw new FailedPredicateException(this, "\"d\".equals(getCurrentToken().getText())");
				setState(49);
				((DeleteElementCommandContext)_localctx).cmd = match(STR);
				setState(51); 
				_errHandler.sync(this);
				_la = _input.LA(1);
				do {
					{
					{
					setState(50);
					((DeleteElementCommandContext)_localctx).STR = match(STR);
					((DeleteElementCommandContext)_localctx).elements.add(((DeleteElementCommandContext)_localctx).STR);
					}
					}
					setState(53); 
					_errHandler.sync(this);
					_la = _input.LA(1);
				} while ( _la==STR );
				}
				break;
			case 5:
				_localctx = new AddOrDeleteEdgeCommandContext(_localctx);
				enterOuterAlt(_localctx, 5);
				{
				setState(55);
				if (!("e".equals(getCurrentToken().getText()))) throw new FailedPredicateException(this, "\"e\".equals(getCurrentToken().getText())");
				setState(56);
				((AddOrDeleteEdgeCommandContext)_localctx).cmd = match(STR);
				setState(57);
				((AddOrDeleteEdgeCommandContext)_localctx).type = match(TYPE_STR);
				setState(58);
				((AddOrDeleteEdgeCommandContext)_localctx).source = match(STR);
				setState(59);
				((AddOrDeleteEdgeCommandContext)_localctx).target = match(STR);
				setState(60);
				((AddOrDeleteEdgeCommandContext)_localctx).anno = qname();
				setState(61);
				match(T__0);
				setState(63);
				_errHandler.sync(this);
				_la = _input.LA(1);
				if (_la==STR) {
					{
					setState(62);
					((AddOrDeleteEdgeCommandContext)_localctx).value = match(STR);
					}
				}

				}
				break;
			case 6:
				_localctx = new HelpCommandContext(_localctx);
				enterOuterAlt(_localctx, 6);
				{
				setState(65);
				if (!("help".equals(getCurrentToken().getText()))) throw new FailedPredicateException(this, "\"help\".equals(getCurrentToken().getText())");
				setState(66);
				((HelpCommandContext)_localctx).cmd = match(STR);
				}
				break;
			case 7:
				_localctx = new ClearCommandContext(_localctx);
				enterOuterAlt(_localctx, 7);
				{
				setState(67);
				if (!("clear".equals(getCurrentToken().getText()))) throw new FailedPredicateException(this, "\"clear\".equals(getCurrentToken().getText())");
				setState(68);
				((ClearCommandContext)_localctx).cmd = match(STR);
				}
				break;
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class Anno_argsContext extends ParserRuleContext {
		public QnameContext anno;
		public Token value;
		public QnameContext qname() {
			return getRuleContext(QnameContext.class,0);
		}
		public TerminalNode STR() { return getToken(ConsoleCommandParser.STR, 0); }
		public Anno_argsContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_anno_args; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).enterAnno_args(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).exitAnno_args(this);
		}
	}

	public final Anno_argsContext anno_args() throws RecognitionException {
		Anno_argsContext _localctx = new Anno_argsContext(_ctx, getState());
		enterRule(_localctx, 4, RULE_anno_args);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(71);
			((Anno_argsContext)_localctx).anno = qname();
			setState(72);
			match(T__0);
			setState(73);
			((Anno_argsContext)_localctx).value = match(STR);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class QnameContext extends ParserRuleContext {
		public Token ns;
		public Token name;
		public List<TerminalNode> STR() { return getTokens(ConsoleCommandParser.STR); }
		public TerminalNode STR(int i) {
			return getToken(ConsoleCommandParser.STR, i);
		}
		public QnameContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_qname; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).enterQname(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).exitQname(this);
		}
	}

	public final QnameContext qname() throws RecognitionException {
		QnameContext _localctx = new QnameContext(_ctx, getState());
		enterRule(_localctx, 6, RULE_qname);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(77);
			_errHandler.sync(this);
			switch ( getInterpreter().adaptivePredict(_input,8,_ctx) ) {
			case 1:
				{
				setState(75);
				((QnameContext)_localctx).ns = match(STR);
				setState(76);
				match(T__1);
				}
				break;
			}
			setState(79);
			((QnameContext)_localctx).name = match(STR);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
		switch (ruleIndex) {
		case 1:
			return command_sempred((CommandContext)_localctx, predIndex);
		}
		return true;
	}
	private boolean command_sempred(CommandContext _localctx, int predIndex) {
		switch (predIndex) {
		case 0:
			return "a".equals(getCurrentToken().getText());
		case 1:
			return "n".equals(getCurrentToken().getText());
		case 2:
			return "s".equals(getCurrentToken().getText());
		case 3:
			return "d".equals(getCurrentToken().getText());
		case 4:
			return "e".equals(getCurrentToken().getText());
		case 5:
			return "help".equals(getCurrentToken().getText());
		case 6:
			return "clear".equals(getCurrentToken().getText());
		}
		return true;
	}

	public static final String _serializedATN =
		"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\bT\4\2\t\2\4\3\t"+
		"\3\4\4\t\4\4\5\t\5\3\2\3\2\7\2\r\n\2\f\2\16\2\20\13\2\3\2\3\2\3\2\3\2"+
		"\3\3\3\3\3\3\6\3\31\n\3\r\3\16\3\32\3\3\3\3\3\3\5\3 \n\3\3\3\3\3\3\3\7"+
		"\3%\n\3\f\3\16\3(\13\3\3\3\3\3\3\3\3\3\6\3.\n\3\r\3\16\3/\3\3\3\3\3\3"+
		"\3\3\6\3\66\n\3\r\3\16\3\67\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\5\3B\n\3\3"+
		"\3\3\3\3\3\3\3\5\3H\n\3\3\4\3\4\3\4\3\4\3\5\3\5\5\5P\n\5\3\5\3\5\3\5\2"+
		"\2\6\2\4\6\b\2\2]\2\n\3\2\2\2\4G\3\2\2\2\6I\3\2\2\2\bO\3\2\2\2\n\16\5"+
		"\4\3\2\13\r\7\b\2\2\f\13\3\2\2\2\r\20\3\2\2\2\16\f\3\2\2\2\16\17\3\2\2"+
		"\2\17\21\3\2\2\2\20\16\3\2\2\2\21\22\7\6\2\2\22\23\3\2\2\2\23\24\7\2\2"+
		"\3\24\3\3\2\2\2\25\26\6\3\2\2\26\30\7\7\2\2\27\31\7\7\2\2\30\27\3\2\2"+
		"\2\31\32\3\2\2\2\32\30\3\2\2\2\32\33\3\2\2\2\33\34\3\2\2\2\34\35\5\b\5"+
		"\2\35\37\7\3\2\2\36 \7\7\2\2\37\36\3\2\2\2\37 \3\2\2\2 H\3\2\2\2!\"\6"+
		"\3\3\2\"&\7\7\2\2#%\7\7\2\2$#\3\2\2\2%(\3\2\2\2&$\3\2\2\2&\'\3\2\2\2\'"+
		")\3\2\2\2(&\3\2\2\2)H\5\6\4\2*+\6\3\4\2+-\7\7\2\2,.\7\7\2\2-,\3\2\2\2"+
		"./\3\2\2\2/-\3\2\2\2/\60\3\2\2\2\60\61\3\2\2\2\61H\5\6\4\2\62\63\6\3\5"+
		"\2\63\65\7\7\2\2\64\66\7\7\2\2\65\64\3\2\2\2\66\67\3\2\2\2\67\65\3\2\2"+
		"\2\678\3\2\2\28H\3\2\2\29:\6\3\6\2:;\7\7\2\2;<\7\5\2\2<=\7\7\2\2=>\7\7"+
		"\2\2>?\5\b\5\2?A\7\3\2\2@B\7\7\2\2A@\3\2\2\2AB\3\2\2\2BH\3\2\2\2CD\6\3"+
		"\7\2DH\7\7\2\2EF\6\3\b\2FH\7\7\2\2G\25\3\2\2\2G!\3\2\2\2G*\3\2\2\2G\62"+
		"\3\2\2\2G9\3\2\2\2GC\3\2\2\2GE\3\2\2\2H\5\3\2\2\2IJ\5\b\5\2JK\7\3\2\2"+
		"KL\7\7\2\2L\7\3\2\2\2MN\7\7\2\2NP\7\4\2\2OM\3\2\2\2OP\3\2\2\2PQ\3\2\2"+
		"\2QR\7\7\2\2R\t\3\2\2\2\13\16\32\37&/\67AGO";
	public static final ATN _ATN =
		new ATNDeserializer().deserialize(_serializedATN.toCharArray());
	static {
		_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
		for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
			_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
		}
	}
}
plugins/de.uni_jena.iaa.linktype.atomic.atomical/src/main/java/org/corpus_tools/atomic/console/parser/ConsoleCommandParser.java
public static class AnnotateCommandContext extends CommandContext {
	public Token cmd;
	public Token STR;
	public List<Token> elements = new ArrayList<Token>();
	public QnameContext anno;
	public Token value;
	public List<TerminalNode> STR() { return getTokens(ConsoleCommandParser.STR); }
	public TerminalNode STR(int i) {
		return getToken(ConsoleCommandParser.STR, i);
	}
	public QnameContext qname() {
		return getRuleContext(QnameContext.class,0);
	}
	public AnnotateCommandContext(CommandContext ctx) { copyFrom(ctx); }
	@Override
	public void enterRule(ParseTreeListener listener) {
		if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).enterAnnotateCommand(this);
	}
	@Override
	public void exitRule(ParseTreeListener listener) {
		if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).exitAnnotateCommand(this);
	}
}
plugins/de.uni_jena.iaa.linktype.atomic.atomical/src/main/java/org/corpus_tools/atomic/console/parser/ConsoleCommandParser.java
public static class DeleteElementCommandContext extends CommandContext {
	public Token cmd;
	public Token STR;
	public List<Token> elements = new ArrayList<Token>();
	public List<TerminalNode> STR() { return getTokens(ConsoleCommandParser.STR); }
	public TerminalNode STR(int i) {
		return getToken(ConsoleCommandParser.STR, i);
	}
	public DeleteElementCommandContext(CommandContext ctx) { copyFrom(ctx); }
	@Override
	public void enterRule(ParseTreeListener listener) {
		if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).enterDeleteElementCommand(this);
	}
	@Override
	public void exitRule(ParseTreeListener listener) {
		if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).exitDeleteElementCommand(this);
	}
}
plugins/de.uni_jena.iaa.linktype.atomic.atomical/src/main/java/org/corpus_tools/atomic/console/parser/ConsoleCommandParser.java
public static class HelpCommandContext extends CommandContext {
	public Token cmd;
	public TerminalNode STR() { return getToken(ConsoleCommandParser.STR, 0); }
	public HelpCommandContext(CommandContext ctx) { copyFrom(ctx); }
	@Override
	public void enterRule(ParseTreeListener listener) {
		if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).enterHelpCommand(this);
	}
	@Override
	public void exitRule(ParseTreeListener listener) {
		if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).exitHelpCommand(this);
	}
}
plugins/de.uni_jena.iaa.linktype.atomic.atomical/src/main/java/org/corpus_tools/atomic/console/parser/ConsoleCommandParser.java
public static class NewStructureNodeCommandContext extends CommandContext {
	public Token cmd;
	public Token STR;
	public List<Token> elements = new ArrayList<Token>();
	public Anno_argsContext anno_args() {
		return getRuleContext(Anno_argsContext.class,0);
	}
	public List<TerminalNode> STR() { return getTokens(ConsoleCommandParser.STR); }
	public TerminalNode STR(int i) {
		return getToken(ConsoleCommandParser.STR, i);
	}
	public NewStructureNodeCommandContext(CommandContext ctx) { copyFrom(ctx); }
	@Override
	public void enterRule(ParseTreeListener listener) {
		if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).enterNewStructureNodeCommand(this);
	}
	@Override
	public void exitRule(ParseTreeListener listener) {
		if ( listener instanceof ConsoleCommandListener ) ((ConsoleCommandListener)listener).exitNewStructureNodeCommand(this);
	}
}
plugins/org.corpus-tools.atomic/src/main/java/org/corpus_tools/atomic/api/salt/SaltGraphUpdatable.java
public interface SaltGraphUpdatable {
	
	public void updateSDocumentGraph(SDocumentGraph newGraph);
}


Question: package de.uni_jena.iaa.linktype.atomic.atomical.console;
import java.io.IOException; 
import java.util.LinkedList;
import java.util.List;
import org.antlr.v4.runtime.Token;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.corpus_tools.atomic.api.editors.DocumentGraphEditor;
import org.corpus_tools.atomic.api.salt.SaltGraphUpdatable;
import org.corpus_tools.atomic.console.parser.ConsoleCommandBaseListener;
import org.corpus_tools.atomic.console.parser.ConsoleCommandParser;
import org.corpus_tools.atomic.console.parser.ConsoleCommandParser.AddOrDeleteEdgeCommandContext;
import org.corpus_tools.atomic.console.parser.ConsoleCommandParser.Anno_argsContext;
import org.corpus_tools.atomic.console.parser.ConsoleCommandParser.AnnotateCommandContext;
import org.corpus_tools.atomic.console.parser.ConsoleCommandParser.DeleteElementCommandContext;
import org.corpus_tools.atomic.console.parser.ConsoleCommandParser.HelpCommandContext;
import org.corpus_tools.atomic.console.parser.ConsoleCommandParser.NewSpanNodeCommandContext;
import org.corpus_tools.atomic.console.parser.ConsoleCommandParser.NewStructureNodeCommandContext;
import org.corpus_tools.salt.SALT_TYPE;
import org.corpus_tools.salt.common.SDocumentGraph;
import org.corpus_tools.salt.common.SSpan;
import org.corpus_tools.salt.common.SStructure;
import org.corpus_tools.salt.common.SStructuredNode;
import org.corpus_tools.salt.common.SToken;
import org.corpus_tools.salt.core.SAnnotation;
import org.corpus_tools.salt.core.SNode;
import org.corpus_tools.salt.core.SRelation;
import org.corpus_tools.salt.util.SaltUtil;
import org.eclipse.emf.common.util.URI;



class CommandExecutor extends ConsoleCommandBaseListener {

	private static final Logger log = LogManager.getLogger(AtomicalConsole.class);
	
	/**
	 * 
	 */
	private final AtomicalConsole atomicalConsole;

	/**
	 * @param atomicalConsole
	 */
	CommandExecutor(AtomicalConsole atomicalConsole) {
		this.atomicalConsole = atomicalConsole;
	}

Answer: 	private DocumentGraphEditor editor;