use of org.eclipse.ui.IEditorInput in project AutoRefactor by JnRouvignac.
the class AutoRefactorHandler method getSelectedJavaElements.
private static List<IJavaElement> getSelectedJavaElements(Shell shell, IEditorPart activeEditor) {
final IEditorInput editorInput = activeEditor.getEditorInput();
final IJavaElement javaElement = JavaUI.getEditorInputJavaElement(editorInput);
if (javaElement instanceof ICompilationUnit) {
return Collections.singletonList(javaElement);
}
showMessage(shell, "This action only works on Java source files");
return Collections.emptyList();
}
use of org.eclipse.ui.IEditorInput in project KaiZen-OpenAPI-Editor by RepreZen.
the class QuickOutline method setInput.
@Override
public void setInput(Object input) {
if (input instanceof Model) {
Model model = (Model) input;
if (model.getPath() == null) {
IFile currentFile = null;
IEditorInput editorInput = editor.getEditorInput();
if (editorInput instanceof IFileEditorInput) {
currentFile = ((IFileEditorInput) editorInput).getFile();
}
if (currentFile != null) {
model.setPath(currentFile.getFullPath());
}
}
}
treeViewer.setInput(input);
treeViewer.setSelection(null, true);
}
use of org.eclipse.ui.IEditorInput in project KaiZen-OpenAPI-Editor by RepreZen.
the class JsonEditor method validate.
private void validate(boolean onOpen) {
IEditorInput editorInput = getEditorInput();
final IDocument document = getDocumentProvider().getDocument(getEditorInput());
// such files.
if (!(editorInput instanceof IFileEditorInput)) {
YEditLog.logError("Marking errors not supported for files outside of a project.");
YEditLog.logger.info("editorInput is not a part of a project.");
return;
}
if (document instanceof JsonDocument) {
final IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput;
final IFile file = fileEditorInput.getFile();
if (onOpen) {
// force parsing of yaml to init parsing errors
((JsonDocument) document).onChange();
}
clearMarkers(file);
validateYaml(file, (JsonDocument) document);
validateSwagger(file, (JsonDocument) document, fileEditorInput);
}
}
use of org.eclipse.ui.IEditorInput in project tdi-studio-se by Talend.
the class TalendLaunchToolbarAction method run.
/**
* Launch the last launch, or open the launch config dialog if none.
*
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
@Override
public void run(IAction action) {
// launch the job that is selected in the repository.
if (selection instanceof IStructuredSelection) {
IStructuredSelection sel = (IStructuredSelection) selection;
Object o = sel.getFirstElement();
if ((o instanceof RepositoryNode)) {
RepositoryNode node = (RepositoryNode) o;
if (node.getObject() != null && node.getObject().getRepositoryObjectType().equals(ERepositoryObjectType.PROCESS)) {
JobLaunchShortcutManager.run(selection);
return;
}
}
}
// launch the job that is open in editor
if (window != null) {
IWorkbenchPage page = window.getActivePage();
if (page != null) {
if (page.getActivePart() == page.getActiveEditor()) {
IEditorPart editor = page.getActiveEditor();
IEditorInput input = editor.getEditorInput();
if (input instanceof RepositoryEditorInput) {
JobLaunchShortcutManager.run(editor);
return;
}
}
}
}
ILaunchConfiguration configuration = getLastLaunch();
if (configuration == null) {
// MessageDialog
// .openInformation(
// DebugUIPlugin.getShell(),
// Messages.getString("TalendLaunchToolbarAction.information"), Messages.getString("TalendLaunchToolbarAction.noAvailableItem")); //$NON-NLS-1$ //$NON-NLS-2$
MessageDialog.openInformation(getShell(), Messages.getString("TalendLaunchToolbarAction.information"), //$NON-NLS-1$ //$NON-NLS-2$
Messages.getString("TalendLaunchToolbarAction.noAvailableItem"));
// DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), new StructuredSelection(),
// getLaunchGroupIdentifier());
} else {
DebugUITools.launch(configuration, getMode());
}
}
use of org.eclipse.ui.IEditorInput in project tdi-studio-se by Talend.
the class SQLPatternComposite method getCurrentOpenEditorType.
public ERepositoryObjectType getCurrentOpenEditorType(IEditorReference editor) throws PartInitException {
IEditorInput editorInput = editor.getEditorInput();
if (editorInput instanceof RepositoryEditorInput) {
RepositoryEditorInput repoEditorInput = (RepositoryEditorInput) editorInput;
Item item = repoEditorInput.getItem();
return ERepositoryObjectType.getItemType(item);
}
return null;
}
Aggregations