use of org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject in project webtools.sourceediting by eclipse.
the class ADTContentOutlineProvider method removeListener.
/**
* @param model
*/
private void removeListener(IADTObject model) {
model.unregisterListener(this);
Object[] children = null;
if (model instanceof ITreeElement) {
children = ((ITreeElement) model).getChildren();
}
if (children != null) {
int length = children.length;
for (int i = 0; i < length; i++) {
Object child = children[i];
if (child instanceof IADTObject && model != child) {
removeListener((IADTObject) child);
}
}
}
}
use of org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject in project webtools.sourceediting by eclipse.
the class BaseEditPart method deactivate.
public void deactivate() {
try {
Object model = getModel();
if (model instanceof IADTObject) {
IADTObject object = (IADTObject) model;
object.unregisterListener(this);
}
if (getZoomManager() != null)
getZoomManager().removeZoomListener(zoomListener);
} finally {
super.deactivate();
}
}
use of org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject in project webtools.sourceediting by eclipse.
the class DeleteAction method run.
public void run() {
for (Iterator i = ((IStructuredSelection) getSelection()).iterator(); i.hasNext(); ) {
Object selection = i.next();
Command command = null;
boolean doSetInput = false;
boolean doSetModelAsInput = false;
IADTObject topLevelContainer = null;
IModel model = null;
if (selection instanceof IGraphElement) {
IGraphElement xsdObj = (IGraphElement) selection;
if (xsdObj instanceof XSDBaseAdapter) {
XSDBaseAdapter baseAdapter = (XSDBaseAdapter) xsdObj;
// is null and the read only check cannot be completed
if (baseAdapter == null || baseAdapter.isReadOnly()) {
continue;
}
topLevelContainer = xsdObj.getTopContainer();
if (topLevelContainer == selection) {
doSetInput = true;
doSetModelAsInput = true;
}
command = xsdObj.getDeleteCommand();
model = xsdObj.getModel();
}
}
if (command != null) {
IWorkbench workbench = PlatformUI.getWorkbench();
if (workbench != null) {
IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
if (workbenchWindow != null && workbenchWindow.getActivePage() != null) {
IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
if (editorPart != null) {
Object viewer = editorPart.getAdapter(GraphicalViewer.class);
if (viewer instanceof DesignViewGraphicalViewer) {
Object input = ((DesignViewGraphicalViewer) viewer).getInput();
if (input != selection) {
// Bug 86218 : Don't switch to top level view if the object we're deleting
// is not the input to the viewer
doSetInput = false;
}
}
}
}
}
command.execute();
if (doSetInput) {
if (model != null && doSetModelAsInput)
provider.setSelection(new StructuredSelection(model));
else if (topLevelContainer != null && !doSetModelAsInput)
provider.setSelection(new StructuredSelection(topLevelContainer));
}
}
}
}
use of org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject in project webtools.sourceediting by eclipse.
the class RootContentEditPart method activate.
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=252589
public void activate() {
super.activate();
Object model = getModel();
// The schema adapter doesn't have to notify the RootContentEditPart of it changes
if (model instanceof IADTObject) {
IADTObject object = (IADTObject) model;
object.unregisterListener(this);
}
}
use of org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject in project webtools.sourceediting by eclipse.
the class RootHolderEditPart method getModelChildren.
protected List getModelChildren() {
List collections = new ArrayList();
RootHolder holder = (RootHolder) getModel();
IADTObject focusObject = holder.getModel();
collections.add(new FocusTypeColumn(focusObject));
collections.add(new ReferencedTypeColumn(focusObject));
return collections;
}
Aggregations