use of org.erlide.ui.editors.erl.AbstractErlangEditor in project erlide_eclipse by erlang.
the class ErlangNodeLaunchShortcut method launch.
@Override
public void launch(final IEditorPart editor, final String mode) {
ErlLogger.debug("** Launch :: " + editor.getTitle());
if (editor instanceof AbstractErlangEditor) {
final AbstractErlangEditor erlangEditor = (AbstractErlangEditor) editor;
final IErlProject project = erlangEditor.getProject();
if (project != null) {
try {
doLaunch(mode, Lists.newArrayList(project));
} catch (final CoreException e) {
final IWorkbench workbench = PlatformUI.getWorkbench();
final Shell shell = workbench.getActiveWorkbenchWindow().getShell();
MessageDialog.openError(shell, "Error", e.getStatus().getMessage());
}
}
}
}
use of org.erlide.ui.editors.erl.AbstractErlangEditor in project erlide_eclipse by erlang.
the class ErlangSearchPage method tryErlangTextSelection.
public SearchPatternData tryErlangTextSelection(final SearchPatternData initData0, final IEditorPart activePart) throws ErlModelException {
final AbstractErlangEditor erlangEditor = (AbstractErlangEditor) activePart;
final IErlModule module = erlangEditor.getModule();
SearchPatternData initData = initData0;
if (module != null) {
final ISelection ssel = erlangEditor.getSite().getSelectionProvider().getSelection();
final ITextSelection textSel = (ITextSelection) ssel;
final int offset = textSel.getOffset();
OpenResult res;
try {
res = ErlangEngine.getInstance().getOpenService().open(module.getScannerName(), offset, ErlangEngine.getInstance().getModelUtilService().getImportsAsList(module), "", ErlangEngine.getInstance().getModel().getPathVars());
} catch (final RpcException e) {
res = null;
}
ErlLogger.debug("searchPage(open) " + res);
initData = determineInitValuesFrom(module, offset, res);
}
return initData;
}
use of org.erlide.ui.editors.erl.AbstractErlangEditor in project erlide_eclipse by erlang.
the class ErlangSearchResult method isShownInEditor.
@Override
public boolean isShownInEditor(final Match match, final IEditorPart editor) {
final ErlangSearchElement ese = (ErlangSearchElement) match.getElement();
final IFile file = ResourceUtil.getFileFromLocation(ese.getModuleName());
if (editor instanceof ErlangEditor) {
final AbstractErlangEditor erlangEditor = (AbstractErlangEditor) editor;
final IErlModule module = erlangEditor.getModule();
if (module != null) {
if (file != null) {
return file.equals(module.getResource());
}
return ese.getModuleName().equals(module.getFilePath());
}
}
return false;
}
use of org.erlide.ui.editors.erl.AbstractErlangEditor in project erlide_eclipse by erlang.
the class ErlangSearchResultPage method showMatch.
@Override
protected void showMatch(final Match match, final int offset, final int length, final boolean activate) throws PartInitException {
final Object element = match.getElement();
if (element instanceof ErlangSearchElement) {
final ErlangSearchElement ese = (ErlangSearchElement) element;
final IErlModule module = ese.getModule();
final IEditorPart editor = EditorUtility.openInEditor(module);
if (offset != 0) {
if (editor instanceof ErlangEditor) {
final AbstractErlangEditor ee = (AbstractErlangEditor) editor;
ee.selectAndReveal(offset, length);
} else if (editor != null) {
showWithMarker(editor, module, offset, length);
}
}
}
}
use of org.erlide.ui.editors.erl.AbstractErlangEditor in project erlide_eclipse by erlang.
the class ErlBreakpointAdapterFactory method getAdapter.
@Override
@Nullable
public <@Nullable T> T getAdapter(final Object adaptableObject, final Class<@Nullable T> adapterType) {
if (adaptableObject instanceof ErlangEditor) {
final AbstractErlangEditor editorPart = (AbstractErlangEditor) adaptableObject;
final IResource resource = editorPart.getEditorInput().getAdapter(IResource.class);
if (resource != null) {
final String extension = resource.getFileExtension();
if (extension != null && "erl".equals(extension)) {
return adapterType.cast(new ErlLineBreakpointAdapter());
}
}
}
return null;
}
Aggregations