1 11 package org.eclipse.ui.internal; 12 13 import org.eclipse.jface.action.IMenuManager; 14 import org.eclipse.swt.graphics.Point; 15 import org.eclipse.ui.presentations.IPresentablePart; 16 import org.eclipse.ui.presentations.IStackPresentationSite; 17 import org.eclipse.ui.presentations.StackPresentation; 18 19 22 public abstract class DefaultStackPresentationSite implements 23 IStackPresentationSite { 24 25 private StackPresentation presentation; 26 27 private int state = IStackPresentationSite.STATE_RESTORED; 28 29 private int activeState = StackPresentation.AS_INACTIVE; 30 31 public DefaultStackPresentationSite() { 32 33 } 34 35 public void setPresentation(StackPresentation newPresentation) { 36 presentation = newPresentation; 37 if (presentation != null) { 38 presentation.setState(state); 39 presentation.setActive(activeState); 40 } 41 } 42 43 public StackPresentation getPresentation() { 44 return presentation; 45 } 46 47 public int getState() { 48 return state; 49 } 50 51 public void setActive(int activeState) { 52 if (activeState != this.activeState) { 53 this.activeState = activeState; 54 if (presentation != null) { 55 presentation.setActive(activeState); 56 } 57 } 58 } 59 60 public int getActive() { 61 return activeState; 62 } 63 64 67 public void selectPart(IPresentablePart toSelect) { 68 69 if (presentation != null) { 70 presentation.selectPart(toSelect); 71 } 72 } 73 74 public void dispose() { 75 if (presentation != null) { 76 presentation.dispose(); 77 } 78 setPresentation(null); 79 } 80 81 84 public void setState(int newState) { 85 setPresentationState(newState); 86 } 87 88 public void setPresentationState(int newState) { 89 state = newState; 90 if (presentation != null) { 91 presentation.setState(newState); 92 } 93 } 94 95 98 public boolean isCloseable(IPresentablePart part) { 99 return part.isCloseable(); 100 } 101 102 105 public void dragStart(IPresentablePart beingDragged, Point initialPosition, 106 boolean keyboard) { 107 } 108 109 112 public void close(IPresentablePart toClose) { 113 } 114 115 118 public void dragStart(Point initialPosition, boolean keyboard) { 119 } 120 121 124 public boolean supportsState(int state) { 125 return true; 126 } 127 128 131 public abstract IPresentablePart getSelectedPart(); 132 133 public void addSystemActions(IMenuManager menuManager) { 134 135 } 136 137 public abstract boolean isPartMoveable(IPresentablePart toMove); 138 139 public abstract boolean isStackMoveable(); 140 141 } 142 | Popular Tags |