private void tryToInitFromActiveEditor() { IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); if (editor instanceof FormEditor) { FormEditor fe = (FormEditor) editor; IFormPage page = fe.getActivePageInstance(); if (page.getEditorInput() instanceof GenericEditorInput<?>) { GenericEditorInput<?> editorInput = (GenericEditorInput<?>) page.getEditorInput(); Object obj = editorInput.getEntity(); if (obj instanceof Deployment) { addDeployment((Deployment) obj); } setLighthouseDomain(editorInput.getDomain()); } } }
IJavaProject getJavaProject() { IFormPage formPage = (IFormPage) getManagedForm().getContainer(); IFile file = ResourceUtil.getFile(formPage.getEditorInput()); return file != null ? JavaCore.create(file.getProject()) : null; }