use of org.eclipse.ui.IEditorInput in project KaiZen-OpenAPI-Editor by RepreZen.
the class QuickOutline method handleMultiView.
protected void handleMultiView() {
currentScope = currentScope.next();
SwaggerFileFinder fileFinder = new SwaggerFileFinder(fileContentType);
IEditorInput input = editor.getEditorInput();
IFile currentFile = null;
if (input instanceof IFileEditorInput) {
currentFile = ((IFileEditorInput) input).getFile();
}
Iterable<IFile> files = fileFinder.collectFiles(currentScope, currentFile);
setInfoText(statusMessage());
if (currentScope == Scope.LOCAL) {
treeViewer.setAutoExpandLevel(2);
} else {
treeViewer.setAutoExpandLevel(0);
}
setInput(Model.parseYaml(files, getSchema()));
}
use of org.eclipse.ui.IEditorInput in project tesb-studio-se by Talend.
the class CamelEditorDropTargetListener method createContext.
private void createContext() {
if (selectSourceList.size() == 0) {
return;
}
boolean created = false;
for (Object source : selectSourceList) {
if (source instanceof RepositoryNode) {
RepositoryNode sourceNode = (RepositoryNode) source;
Item item = sourceNode.getObject().getProperty().getItem();
if (item instanceof ContextItem) {
ContextItem contextItem = (ContextItem) item;
EList context = contextItem.getContext();
Set<String> contextSet = new HashSet<String>();
Iterator iterator = context.iterator();
while (iterator.hasNext()) {
Object obj = iterator.next();
if (obj instanceof ContextTypeImpl) {
EList contextParameters = ((ContextTypeImpl) obj).getContextParameter();
Iterator contextParas = contextParameters.iterator();
while (contextParas.hasNext()) {
ContextParameterTypeImpl contextParameterType = (ContextParameterTypeImpl) contextParas.next();
String name = contextParameterType.getName();
contextSet.add(name);
}
}
}
IEditorInput editorInput = editor.getEditorInput();
if (editorInput instanceof JobEditorInput) {
JobEditorInput jobInput = (JobEditorInput) editorInput;
IProcess2 process = jobInput.getLoadedProcess();
IContextManager contextManager = process.getContextManager();
List<IContext> listContext = contextManager.getListContext();
Set<String> addedVars = ConnectionContextHelper.checkAndAddContextVariables(contextItem, contextSet, process.getContextManager(), false);
if (addedVars != null && !addedVars.isEmpty() && !ConnectionContextHelper.isAddContextVar(contextItem, contextManager, contextSet)) {
// show
Map<String, Set<String>> addedVarsMap = new HashMap<String, Set<String>>();
addedVarsMap.put(item.getProperty().getLabel(), contextSet);
if (ConnectionContextHelper.showContextdialog(process, contextItem, process.getContextManager(), addedVarsMap, contextSet)) {
created = true;
}
} else {
//$NON-NLS-1$
MessageDialog.openInformation(//$NON-NLS-1$
editor.getEditorSite().getShell(), //$NON-NLS-1$
"Adding Context", //$NON-NLS-1$
"Context \"" + contextItem.getProperty().getDisplayName() + "\" already exist.");
}
}
}
}
}
if (created) {
RepositoryPlugin.getDefault().getDesignerCoreService().switchToCurContextsView();
}
}
use of org.eclipse.ui.IEditorInput in project tesb-studio-se by Talend.
the class LocalWSDLEditor method dispose.
@Override
public void dispose() {
// unlock item if necessary
IEditorInput currentEditorInput = getEditorInput();
if (currentEditorInput instanceof RepositoryEditorInput) {
RepositoryEditorInput serviceEditorInput = (RepositoryEditorInput) currentEditorInput;
Item currentItem = serviceEditorInput.getItem();
if (currentItem != null) {
// unlock item if no other editors open it.
boolean openItemInOtherEditor = false;
IEditorReference[] editorRefs = getEditorSite().getPage().getEditorReferences();
for (IEditorReference editorRef : editorRefs) {
if (editorRef.getEditor(false) == this) {
continue;
}
try {
IEditorInput editorInput = editorRef.getEditorInput();
if (editorInput instanceof RepositoryEditorInput) {
Item item = ((RepositoryEditorInput) editorInput).getItem();
if (item == currentItem) {
// open this item & not this one.
openItemInOtherEditor = true;
}
}
} catch (PartInitException e) {
// ignore and compare others
ExceptionHandler.process(e);
}
}
if (!openItemInOtherEditor) {
try {
DesignerPlugin.getDefault().getProxyRepositoryFactory().unlock(currentItem);
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
}
}
super.dispose();
}
use of org.eclipse.ui.IEditorInput in project tesb-studio-se by Talend.
the class OpenAnotherVersionResourceAction method getCorrespondingEditor.
protected IEditorPart getCorrespondingEditor(RepositoryNode node) {
for (IEditorReference ref : getActivePage().getEditorReferences()) {
try {
IEditorInput input = ref.getEditorInput();
if (!(input instanceof RouteResourceInput)) {
continue;
}
RouteResourceInput repositoryInput = (RouteResourceInput) input;
if (repositoryInput.getItem().equals(node.getObject().getProperty().getItem())) {
return ref.getEditor(false);
}
} catch (PartInitException e) {
continue;
}
}
return null;
}
use of org.eclipse.ui.IEditorInput in project tdi-studio-se by Talend.
the class OpenDeclarationAction method run.
/*
* @see Action#run()
*/
@Override
public void run() {
if (className == null) {
return;
}
// search source
IType source = null;
try {
source = searchSource();
} catch (InterruptedException e) {
return;
}
if (source == null) {
MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.errorLabel, Messages.openDeclarationFailedMsg);
return;
}
// get editor input
IDebugModelPresentation presentation = DebugUITools.newDebugModelPresentation(JDIDebugModel.getPluginIdentifier());
if (presentation == null) {
return;
}
IEditorInput editorInput = presentation.getEditorInput(source);
if (editorInput == null) {
return;
}
// open editor
IEditorPart editorPart = null;
try {
editorPart = openEditor(editorInput, presentation, source);
} catch (PartInitException e) {
Activator.log(IStatus.ERROR, Messages.openEditorFailedMsg, e);
}
presentation.dispose();
if (editorPart == null) {
return;
}
// highlight method
try {
highlightMethod(editorInput, editorPart);
} catch (CoreException e) {
Activator.log(IStatus.ERROR, Messages.highlightMethodFailedMsg, e);
}
}
Aggregations