use of org.erlide.engine.model.ErlModelException in project erlide_eclipse by erlang.
the class SimpleCodeInspectionHandler method createErlModuleList.
private ArrayList<IErlElement> createErlModuleList(final OtpErlangList modList) {
final ArrayList<IErlElement> modules = new ArrayList<>();
for (int i = 0; i < modList.arity(); ++i) {
IErlModule m;
try {
m = extractModule(modList.elementAt(i));
modules.add(m);
} catch (final ErlModelException e) {
}
}
return modules;
}
use of org.erlide.engine.model.ErlModelException in project erlide_eclipse by erlang.
the class DebuggerTraceView method gotoModuleLine.
// @Override
// public void createPartControl(final Composite parent) {
// viewer = new TreeViewer(new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL
// | SWT.MULTI | SWT.FULL_SELECTION));
// setViewer(viewer);
// super.createPartControl(parent);
// // parent.setLayout(new FillLayout());
//
// viewer.getTree().setLinesVisible(true);
// viewer.setUseHashlookup(true);
//
// createColumns();
//
// viewer.setContentProvider(getContentProvider());
// viewer.setLabelProvider(new ColumnLabelProvider());
// getSite().setSelectionProvider(viewer);
//
// viewer.setInput(this);
// DebugPlugin.getDefault().addDebugEventListener(this);
//
// // viewer.getTree().addTreeListener(new TreeAdapter() {
// // @Override
// // public void treeCollapsed(final TreeEvent e) {
// // removeExpandedCategory((MarkerCategory) e.item.getData());
// // }
// //
// // @Override
// // public void treeExpanded(final TreeEvent e) {
// // addExpandedCategory((MarkerCategory) e.item.getData());
// // }
// // });
//
// // // Set help on the view itself
// // viewer.getControl().addHelpListener(new HelpListener() {
// // public void helpRequested(HelpEvent e) {
// // Object provider = getAdapter(IContextProvider.class);
// // if (provider == null) {
// // return;
// // }
// //
// // IContext context = ((IContextProvider) provider)
// // .getContext(viewer.getControl());
// // PlatformUI.getWorkbench().getHelpSystem().displayHelp(context);
// // }
// //
// // });
//
// viewer.getTree().addSelectionListener(new SelectionAdapter() {
// @Override
// public void widgetSelected(final SelectionEvent e) {
// final Object o = getSelectedInTree();
// final String msg = o == null ? "" : o.toString(); //$NON-NLS-1$
// getViewSite().getActionBars().getStatusLineManager()
// .setMessage(msg);
//
// }
// });
//
// viewer.getTree().addMouseListener(new MouseListener() {
//
// public void mouseDoubleClick(final MouseEvent e) {
// final Object o = getSelectedInTree();
// if (o instanceof OtpErlangTuple) {
// final OtpErlangTuple t = (OtpErlangTuple) o;
// final OtpErlangTuple t2 = (OtpErlangTuple) t.elementAt(1);
// final OtpErlangTuple ieval = (OtpErlangTuple) t2
// .elementAt(0);
// final OtpErlangAtom mod = (OtpErlangAtom) ieval
// .elementAt(3);
// final String module = mod.atomValue();
// final OtpErlangLong lin = (OtpErlangLong) ieval
// .elementAt(2);
// try {
// final int line = lin.intValue();
// gotoModuleLine(module, line);
// } catch (final OtpErlangRangeException e1) {
// }
//
// }
// }
//
// public void mouseDown(final MouseEvent e) {
// }
//
// public void mouseUp(final MouseEvent e) {
// }
//
// });
// // PlatformUI.getWorkbench().getWorkingSetManager()
// // .addPropertyChangeListener(getWorkingSetListener());
//
// // registerContextMenu();
// // initDragAndDrop();
//
// }
protected void gotoModuleLine(final String moduleName, final int line) {
final IWorkbenchWindow window = ErlideUIPlugin.getActiveWorkbenchWindow();
if (window == null) {
return;
}
final IWorkbenchPage page = window.getActivePage();
if (page == null) {
return;
}
IEditorPart part = null;
final IErlElementLocator model = ErlangEngine.getInstance().getModel();
IErlModule module;
try {
module = model.findModule(moduleName);
} catch (final ErlModelException e) {
ErlLogger.error(e);
return;
}
IEditorInput input = null;
input = EditorUtility.getEditorInput(module);
if (input != null) {
final String editorId = EditorUtility.getEditorID(input, module);
if (editorId != null) {
try {
part = page.openEditor(input, editorId);
} catch (final PartInitException e) {
ErlideUIPlugin.errorDialog(window.getShell(), "Go to File", "Exception occurred", //
e);
}
}
}
if (part instanceof ErlangEditor) {
part.setFocus();
final ErlangEditor ee = (ErlangEditor) part;
final IDocument d = ee.getDocument();
int lineStart;
int lineLength;
try {
lineStart = d.getLineOffset(line - 1);
lineLength = d.getLineLength(line - 1);
EditorUtility.revealInEditor(ee, lineStart, lineLength - 1);
} catch (final BadLocationException e) {
ErlLogger.error(e);
}
}
}
use of org.erlide.engine.model.ErlModelException in project erlide_eclipse by erlang.
the class DialyzerPreferencePage method doLinkActivated.
void doLinkActivated(final Link widget) {
if (isProjectPreferencePage()) {
openWorkspacePreferences(null);
} else {
final List<IProject> erlProjects = new ArrayList<>();
final Set<IProject> projectsWithSpecifics = new HashSet<>();
final IErlModel model = ErlangEngine.getInstance().getModel();
try {
for (final IErlProject ep : model.getErlangProjects()) {
final IProject p = ep.getWorkspaceProject();
if (hasProjectSpecificOptions(p)) {
projectsWithSpecifics.add(p);
}
erlProjects.add(p);
}
} catch (final ErlModelException e) {
}
final ProjectSelectionDialog dialog = new ProjectSelectionDialog(getShell(), erlProjects, projectsWithSpecifics);
if (dialog.open() == Window.OK) {
final IProject res = (IProject) dialog.getFirstResult();
openProjectProperties(res);
}
}
}
use of org.erlide.engine.model.ErlModelException in project erlide_eclipse by erlang.
the class CoverMainTab method createControl.
@Override
public void createControl(final Composite parent) {
final ScrolledComposite scrolled = new ScrolledComposite(parent, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
final Composite comp = new Composite(scrolled, SWT.NONE);
scrolled.setContent(comp);
scrolled.setExpandVertical(true);
scrolled.setExpandHorizontal(true);
scrolled.setMinSize(760, 300);
setControl(scrolled);
final GridLayout mainLayout = new GridLayout();
mainLayout.numColumns = 3;
mainLayout.verticalSpacing = 15;
mainLayout.horizontalSpacing = 20;
mainLayout.marginHeight = 15;
mainLayout.marginHeight = 15;
comp.setLayout(mainLayout);
final GridData gData = new GridData();
gData.horizontalAlignment = GridData.FILL;
gData.horizontalSpan = 3;
singleRadio = new Button(comp, SWT.RADIO);
singleRadio.setText("Run tests for a single module");
singleRadio.setLayoutData(gData);
singleRadio.addSelectionListener(radioSelectionListener);
createModuleGroup(comp);
allRadio = new Button(comp, SWT.RADIO);
allRadio.setText("Run all tests in specific project");
allRadio.setLayoutData(gData);
allRadio.addSelectionListener(radioSelectionListener);
createAllTestsGroup(comp);
final Label testLabel = new Label(comp, SWT.NONE);
testLabel.setText("Testing framework: ");
testCombo = new Combo(comp, SWT.NONE);
testCombo.setItems(new String[] { FrameworkType.EUNIT.getRepr() });
testCombo.addModifyListener(basicModifyListener);
Collection<IErlProject> projects;
try {
projects = ErlangEngine.getInstance().getModel().getErlangProjects();
final List<String> ps = new ArrayList<>();
for (final IErlProject p : projects) {
ps.add(p.getName());
}
} catch (final ErlModelException e) {
ErlLogger.warn(e);
}
}
use of org.erlide.engine.model.ErlModelException in project erlide_eclipse by erlang.
the class CoverMainTab method createProjectArray.
private Object[] createProjectArray() {
Object[] array;
try {
final List<ProjectElement> res = new LinkedList<>();
final Collection<IErlProject> projects = ErlangEngine.getInstance().getModel().getErlangProjects();
for (final IErlProject p : projects) {
final ProjectElement elem = new ProjectElement(p.getName(), PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(IDE.SharedImages.IMG_OBJ_PROJECT).createImage());
res.add(elem);
}
array = res.toArray();
} catch (final ErlModelException e) {
array = new Object[0];
ErlLogger.error(e);
}
return array;
}
Aggregations