Search in sources :

Example 6 with RouteResourceItem

use of org.talend.camel.core.model.camelProperties.RouteResourceItem in project tesb-studio-se by Talend.

the class CreateRouteResourceAction method doRun.

@Override
protected void doRun() {
    IRepositoryNode node = null;
    NewRouteResourceWizard wizard = null;
    ISelection selection = getSelection();
    if (selection == null) {
        return;
    }
    Object obj = ((IStructuredSelection) selection).getFirstElement();
    node = (IRepositoryNode) obj;
    IRepositoryService service = DesignerPlugin.getDefault().getRepositoryService();
    IPath path = service.getRepositoryPath(node);
    if (RepositoryConstants.isSystemFolder(path.toString())) {
        // Not allowed to create in system folder.
        return;
    }
    wizard = new NewRouteResourceWizard(path);
    WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
    int open = dlg.open();
    if (open == Window.OK) {
        RouteResourceItem item = wizard.getItem();
        IWorkbenchPage page = getActivePage();
        RouteResourceEditorUtil.openEditor(page, null, item);
    }
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) IPath(org.eclipse.core.runtime.IPath) RouteResourceItem(org.talend.camel.core.model.camelProperties.RouteResourceItem) ISelection(org.eclipse.jface.viewers.ISelection) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) NewRouteResourceWizard(org.talend.designer.camel.resource.ui.wizards.NewRouteResourceWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog) IRepositoryService(org.talend.repository.model.IRepositoryService)

Example 7 with RouteResourceItem

use of org.talend.camel.core.model.camelProperties.RouteResourceItem in project tesb-studio-se by Talend.

the class EditRouteResourceAction method openOrBindEditor.

/**
	 * Open or bind RouteResourceEditor
	 * 
	 * @param node
	 */
private void openOrBindEditor(IRepositoryNode node) {
    final Property property = node.getObject().getProperty();
    if (property != null) {
        Assert.isTrue(property.getItem() instanceof RouteResourceItem);
        final RouteResourceItem item = (RouteResourceItem) property.getItem();
        RouteResourceEditorUtil.openEditor(getActivePage(), node, item);
    }
}
Also used : RouteResourceItem(org.talend.camel.core.model.camelProperties.RouteResourceItem) Property(org.talend.core.model.properties.Property)

Aggregations

RouteResourceItem (org.talend.camel.core.model.camelProperties.RouteResourceItem)7 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)3 InputStream (java.io.InputStream)2 IPath (org.eclipse.core.runtime.IPath)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 Item (org.talend.core.model.properties.Item)2 Property (org.talend.core.model.properties.Property)2 ReferenceFileItem (org.talend.core.model.properties.ReferenceFileItem)2 BufferedReader (java.io.BufferedReader)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 IFile (org.eclipse.core.resources.IFile)1 CoreException (org.eclipse.core.runtime.CoreException)1 Path (org.eclipse.core.runtime.Path)1 ISelection (org.eclipse.jface.viewers.ISelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 ToolItem (org.eclipse.swt.widgets.ToolItem)1 PartInitException (org.eclipse.ui.PartInitException)1