Search in sources :

Example 1 with RouteResourceInput

use of org.talend.designer.camel.resource.editors.input.RouteResourceInput in project tesb-studio-se by Talend.

the class RouteResourceEditorUtil method openDefaultEditor.

/**
	 * Open default editor
	 * 
	 * @param page
	 * @param node
	 * @param item
	 */
public static void openDefaultEditor(final IWorkbenchPage page, IRepositoryNode node, RouteResourceItem item) {
    RouteResourceInput fileEditorInput = RouteResourceInput.createInput(node, item);
    openEditor(page, fileEditorInput, item, RouteResourceEditor.ID);
}
Also used : RouteResourceInput(org.talend.designer.camel.resource.editors.input.RouteResourceInput)

Example 2 with RouteResourceInput

use of org.talend.designer.camel.resource.editors.input.RouteResourceInput in project tesb-studio-se by Talend.

the class ResourceEditorListener method partClosed.

@Override
public void partClosed(IWorkbenchPartReference partRef) {
    IWorkbenchPart part = partRef.getPart(true);
    if (part instanceof IEditorPart) {
        IEditorInput input = ((IEditorPart) part).getEditorInput();
        if (input instanceof RouteResourceInput) {
            Item item = ((RouteResourceInput) input).getItem();
            if (item.getProperty().getId().equals(editorInput.getItem().getProperty().getId())) {
                try {
                    ProxyRepositoryFactory.getInstance().unlock(item);
                    page.getWorkbenchWindow().getPartService().removePartListener(this);
                    IResourceChangeListener l = editorInput.getListener();
                    if (null != l) {
                        ResourcesPlugin.getWorkspace().removeResourceChangeListener(l);
                    }
                } catch (Exception e) {
                    ExceptionHandler.process(e);
                }
            }
        }
    }
}
Also used : RouteResourceInput(org.talend.designer.camel.resource.editors.input.RouteResourceInput) Item(org.talend.core.model.properties.Item) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) IEditorPart(org.eclipse.ui.IEditorPart) IResourceChangeListener(org.eclipse.core.resources.IResourceChangeListener) IEditorInput(org.eclipse.ui.IEditorInput)

Example 3 with RouteResourceInput

use of org.talend.designer.camel.resource.editors.input.RouteResourceInput 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;
}
Also used : RouteResourceInput(org.talend.designer.camel.resource.editors.input.RouteResourceInput) IEditorReference(org.eclipse.ui.IEditorReference) PartInitException(org.eclipse.ui.PartInitException) IEditorInput(org.eclipse.ui.IEditorInput)

Aggregations

RouteResourceInput (org.talend.designer.camel.resource.editors.input.RouteResourceInput)3 IEditorInput (org.eclipse.ui.IEditorInput)2 IResourceChangeListener (org.eclipse.core.resources.IResourceChangeListener)1 IEditorPart (org.eclipse.ui.IEditorPart)1 IEditorReference (org.eclipse.ui.IEditorReference)1 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)1 PartInitException (org.eclipse.ui.PartInitException)1 Item (org.talend.core.model.properties.Item)1