import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
import org.simantics.scl.compiler.elaboration.modules.SCLValue;
-import org.simantics.scl.compiler.errors.Locations;
import org.simantics.scl.compiler.module.InvalidModulePathException;
import org.simantics.scl.compiler.module.ModuleUtils;
import org.simantics.scl.compiler.source.ModuleSource;
import org.simantics.scl.osgi.SCLOsgi;
import org.simantics.scl.ui.editor.completion.SCLTextEditorEnvironment;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class OpenDeclaration extends AbstractHandler {
+ private static final Logger LOGGER = LoggerFactory.getLogger(OpenDeclaration.class);
+
private static boolean isIdentifierPart(char c) {
return Character.isJavaIdentifierPart(c) || c=='.';
}
String moduleName = ModuleUtils.resolveAbsolutePath(input.getModuleName(), lineAtCaret.substring(p1+1, p2));
ModuleSource source = SCLOsgi.SOURCE_REPOSITORY.getModuleSource(moduleName, null);
if (source != null) {
- OpenSCLModule.openModule(moduleName);
+ OpenSCLModule.scheduleOpenModule(moduleName);
}
} catch (InvalidModulePathException e) {
- // Nothing to do
+ LOGGER.error("Could not open declaration {} {}", input.getModuleName(), lineAtCaret, e);
}
}
else {
SCLValue value = editorEnvironment.getValue(identifierAtCaret);
//System.out.println("identifierAtCaret = " + identifierAtCaret + " [" + Locations.beginOf(value.definitionLocation) + ", " + Locations.endOf(value.definitionLocation) + "]");
if(value != null)
- OpenSCLDefinition.openDefinition(value);
+ OpenSCLDefinition.scheduleOpenDefinition(value.getName().module, value.definitionLocation);
}
return null;
}