public EngineMetaInterface getActiveMeta() { TabSet tabfolder = spoon.tabfolder; if (tabfolder == null) { return null; } TabItem tabItem = tabfolder.getSelected(); if (tabItem == null) { return null; } // What transformation is in the active tab? // TransLog, TransGraph & TransHist contain the same transformation // TabMapEntry mapEntry = getTab(tabfolder.getSelected()); EngineMetaInterface meta = null; if (mapEntry != null) { if (mapEntry.getObject() instanceof TransGraph) { meta = (mapEntry.getObject()).getMeta(); } if (mapEntry.getObject() instanceof JobGraph) { meta = (mapEntry.getObject()).getMeta(); } } return meta; }
public EngineMetaInterface getActiveMeta() { if (tabfolder == null) return null; TabItem tabItem = tabfolder.getSelected(); if (tabItem == null) return null; // What transformation is in the active tab? // TransLog, TransGraph & TransHist contain the same transformation // TabMapEntry mapEntry = ((Spoon) SpoonFactory.getInstance()).delegates.tabs.getTab(tabfolder.getSelected()); EngineMetaInterface meta = null; if (mapEntry != null) { if (mapEntry.getObject() instanceof TransGraph) meta = (mapEntry.getObject()).getMeta(); if (mapEntry.getObject() instanceof JobGraph) meta = (mapEntry.getObject()).getMeta(); } return meta; }
public boolean addSpoonBrowser( String name, String urlString, boolean isURL, LocationListener listener) { TabSet tabfolder = spoon.tabfolder; try { // OK, now we have the HTML, create a new browset tab. // See if there already is a tab for this browser // If no, add it // If yes, select that tab // TabMapEntry tabMapEntry = findTabMapEntry(name, ObjectType.BROWSER); if (tabMapEntry == null) { CTabFolder cTabFolder = tabfolder.getSwtTabset(); final SpoonBrowser browser = new SpoonBrowser(cTabFolder, spoon, urlString, isURL, true, listener); browser .getBrowser() .addOpenWindowListener( new OpenWindowListener() { @Override public void open(WindowEvent event) { if (event.required) { event.browser = browser.getBrowser(); } } }); TabItem tabItem = new TabItem(tabfolder, name, name); tabItem.setImage(GUIResource.getInstance().getImageLogoSmall()); tabItem.setControl(browser.getComposite()); tabMapEntry = new TabMapEntry( tabItem, isURL ? urlString : null, name, null, null, browser, ObjectType.BROWSER); tabMap.add(tabMapEntry); } int idx = tabfolder.indexOf(tabMapEntry.getTabItem()); // keep the focus on the graph tabfolder.setSelected(idx); return true; } catch (Throwable e) { boolean ok = false; if (isURL) { // Retry to show the welcome page in an external browser. // Status status = Launch.openURL(urlString); ok = status.equals(Status.Success); } if (!ok) { // Log an error // log.logError("Unable to open browser tab", e); return false; } else { return true; } } }