@Override public void removeSelectionChangedListener(ISelectionChangedListener listener) { // getCurrentComponent().removeSelectionChangedListener(listener); defaultComponent.removeSelectionChangedListener(listener); for (ViewersMultiSandboxViewComponent c : additionalComponents) { c.removeSelectionChangedListener(listener); } }
@Override public void dispose() { defaultComponent.dispose(); for (ViewersMultiSandboxViewComponent c : additionalComponents) { c.dispose(); } getSite().getPage().removeSelectionListener(forwardRevealListener); super.dispose(); }
public void initializeContents( EMFScope model, Collection<IQuerySpecification<?>> queries, ViewerDataFilter filter) throws ViatraQueryException { if (model != null) { defaultComponent.initializeContents(model, queries, filter); for (ViewersMultiSandboxViewComponent c : additionalComponents) { c.initializeContents(model, queries, filter); } } }
protected void setCurrentComponent(ViewersMultiSandboxViewComponent newCurrent) { ViewersMultiSandboxViewComponent previous = getCurrentComponent(); if (previous != null) { previous.setBackGround(); } this.currentComponent = newCurrent; newCurrent.setForeground(); // refresh toolbar fillToolBar(newCurrent); }
public void run() { if (defaultComponent.equals(currentComponent)) { // do nothing, we cannot close the default component } else { // set the default as the current ViewersMultiSandboxViewComponent target = getCurrentComponent(); setCurrentComponent(defaultComponent); // remove selection changed listeners for (ISelectionChangedListener l : defaultComponent.selectionHelper.selectionChangedListeners) { target.removeSelectionChangedListener(l); } target.dispose(); additionalComponents.remove(target); container.layout(); } }
public void run() { ViewersMultiSandboxViewComponent newC = new ViewersMultiSandboxViewComponent(ViewersMultiSandboxView.this); additionalComponents.add(newC); // add selection changed listeners for (ISelectionChangedListener l : defaultComponent.selectionHelper.selectionChangedListeners) { newC.addSelectionChangedListener(l); } // set contents from default try { newC.initializeContents(defaultComponent.initialConfiguration); } catch (ViatraQueryException e) { log("addNewComponentAction.run", e); } // container.pack(); container.layout(); }
// this should be called each time the current component is changed OR the tab inside a component // is changed void fillToolBar(ViewersMultiSandboxViewComponent c) { // add items for the multi operation IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager(); mgr.removeAll(); mgr.add(getSwitchSashingAction); mgr.add(getAddNewComponentAction); mgr.add(getCloseCurrentComponentAction); mgr.add(new Separator()); c.fillToolBarBasedOnCurrentTab(); getViewSite().getActionBars().updateActionBars(); }
@Override public void createPartControl(Composite parent) { parent.setLayout(new FillLayout(SWT.HORIZONTAL)); // container = new Composite(parent, SWT.NONE); // container.setLayout(new GridLayout(1, false)); container = new SashForm(parent, SWT.VERTICAL); // initialize the default component defaultComponent = new ViewersMultiSandboxViewComponent(this); defaultComponent.setForeground(); this.currentComponent = defaultComponent; fillToolBar(getCurrentComponent()); getSite().setSelectionProvider(this); getSite().getPage().addSelectionListener(forwardRevealListener); }