use of org.eclipse.wst.xsd.ui.internal.adt.editor.ProductCustomizationProvider in project webtools.sourceediting by eclipse.
the class InternalXSDMultiPageEditor method createNavigationLocation.
public INavigationLocation createNavigationLocation() {
if (getActivePage() == DESIGN_PAGE_INDEX) {
try {
RootEditPart rootEditPart = graphicalViewer.getRootEditPart();
EditPart editPart = rootEditPart.getContents();
if (editPart instanceof RootContentEditPart) {
RootContentEditPart rootContentEditPart = (RootContentEditPart) editPart;
Object input = rootContentEditPart.getInput();
if (input instanceof Adapter) {
XSDConcreteComponent concreteComponent = (XSDConcreteComponent) ((Adapter) input).getTarget();
Object object = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getAdapter(ProductCustomizationProvider.class);
if (object instanceof ProductCustomizationProvider) {
ProductCustomizationProvider productCustomizationProvider = (ProductCustomizationProvider) object;
if (productCustomizationProvider != null) {
return productCustomizationProvider.getNavigationLocation(this, concreteComponent, rootContentEditPart);
}
}
return new DesignViewNavigationLocation(this, concreteComponent);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
} else {
return new MultiPageEditorTextSelectionNavigationLocation(getTextEditor(), true);
}
}
use of org.eclipse.wst.xsd.ui.internal.adt.editor.ProductCustomizationProvider in project webtools.sourceediting by eclipse.
the class InternalXSDMultiPageEditor method createEditorModeManager.
// private boolean isInitializing = false;
protected EditorModeManager createEditorModeManager() {
final ProductCustomizationProvider productCustomizationProvider = (ProductCustomizationProvider) getAdapter(ProductCustomizationProvider.class);
EditorModeManager manager = new EditorModeManager(XSD_EDITOR_MODE_EXTENSION_ID) {
public void init() {
if (productCustomizationProvider == null || productCustomizationProvider.isEditorModeApplicable(TypeVizEditorMode.ID)) {
addMode(new TypeVizEditorMode());
}
super.init();
}
protected EditorMode getDefaultMode() {
String defaultModeId = XSDEditorPlugin.getPlugin().getPreferenceStore().getString(DEFAULT_EDITOR_MODE_ID);
if (defaultModeId != null) {
EditorMode editorMode = getEditorMode(defaultModeId);
if (editorMode != null) {
return editorMode;
}
}
return super.getDefaultMode();
}
};
manager.setProductCustomizationProvider(productCustomizationProvider);
return manager;
}
Aggregations