bool PerspectiveRegistryReader::ReadElement(const IConfigurationElement::Pointer &element) { if (element->GetName() == WorkbenchRegistryConstants::TAG_PERSPECTIVE) { try { QString id = element->GetAttribute(WorkbenchRegistryConstants::ATT_ID); PerspectiveDescriptor::Pointer desc( new PerspectiveDescriptor(id, element)); QList<berry::IConfigurationElement::Pointer> childs = element->GetChildren("description"); if (!childs.isEmpty()) { desc->SetDescription(childs[0]->GetValue()); } registry->AddPerspective(desc); } catch (const CoreException& e) { // log an error since its not safe to open a dialog here WorkbenchPlugin::Log("Unable to create layout descriptor.", e);//$NON-NLS-1$ } return true; } return false; }
Expression::Pointer StandardElementHandler::Create(ExpressionConverter* converter, IConfigurationElement::Pointer element) { std::string name = element->GetName(); if (ExpressionTagNames::INSTANCEOF == name) { Expression::Pointer result(new InstanceofExpression(element)); return result; } else if (ExpressionTagNames::TEST == name) { Expression::Pointer result(new TestExpression(element)); return result; } else if (ExpressionTagNames::OR == name) { CompositeExpression::Pointer result(new OrExpression()); this->ProcessChildren(converter, element, result); return result; } else if (ExpressionTagNames::AND == name) { CompositeExpression::Pointer result(new AndExpression()); this->ProcessChildren(converter, element, result); return result; } else if (ExpressionTagNames::NOT == name) { IConfigurationElement::vector children(element->GetChildren()); Expression::Pointer result(new NotExpression(converter->Perform(children[0]))); return result; } else if (ExpressionTagNames::WITH == name) { CompositeExpression::Pointer result(new WithExpression(element)); this->ProcessChildren(converter, element, result); return result; } else if (ExpressionTagNames::ADAPT == name) { CompositeExpression::Pointer result(new AdaptExpression(element)); this->ProcessChildren(converter, element, result); return result; } else if (ExpressionTagNames::ITERATE == name) { CompositeExpression::Pointer result(new IterateExpression(element)); this->ProcessChildren(converter, element, result); return result; } else if (ExpressionTagNames::COUNT == name) { Expression::Pointer result(new CountExpression(element)); return result; } else if (ExpressionTagNames::SYSTEM_TEST == name) { Expression::Pointer result(new SystemTestExpression(element)); return result; } else if (ExpressionTagNames::RESOLVE == name) { CompositeExpression::Pointer result(new ResolveExpression(element)); this->ProcessChildren(converter, element, result); return result; } else if (ExpressionTagNames::ENABLEMENT == name) { CompositeExpression::Pointer result(new EnablementExpression(element)); this->ProcessChildren(converter, element, result); return result; } else if (ExpressionTagNames::EQUALS == name) { Expression::Pointer result(new EqualsExpression(element)); return result; } else if (ExpressionTagNames::REFERENCE == name) { Expression::Pointer result(new ReferenceExpression(element)); return result; } return Expression::Pointer(); }
bool PerspectiveExtensionReader::ProcessExtension( IConfigurationElement::Pointer element) { IConfigurationElement::vector children = element->GetChildren(); for (unsigned int nX = 0; nX < children.size(); nX++) { IConfigurationElement::Pointer child = children[nX]; std::string type = child->GetName(); if (this->IncludeTag(type)) { bool result = false; if (type == WorkbenchRegistryConstants::TAG_ACTION_SET) { result = this->ProcessActionSet(child); } else if (type == WorkbenchRegistryConstants::TAG_VIEW) { result = this->ProcessView(child); } else if (type == WorkbenchRegistryConstants::TAG_VIEW_SHORTCUT) { result = this->ProcessViewShortcut(child); } // else if (type == IorkbenchRegistryConstants::TAG_NEW_WIZARD_SHORTCUT) // { // result = processWizardShortcut(child); // } else if (type == WorkbenchRegistryConstants::TAG_PERSP_SHORTCUT) { result = this->ProcessPerspectiveShortcut(child); } else if (type == WorkbenchRegistryConstants::TAG_SHOW_IN_PART) { result = this->ProcessShowInPart(child); } if (!result) { WorkbenchPlugin::Log("Unable to process element: " + //$NON-NLS-1$ type + " in perspective extension: " + //$NON-NLS-1$ element->GetDeclaringExtension()->GetUniqueIdentifier()); } } } return true; }
bool PerspectiveExtensionReader::ReadElement( IConfigurationElement::Pointer element) { std::string type = element->GetName(); if (type == WorkbenchRegistryConstants::TAG_PERSPECTIVE_EXTENSION) { std::string id; element->GetAttribute(WorkbenchRegistryConstants::ATT_TARGET_ID, id); if (targetID == id || "*" == id) { //$NON-NLS-1$ // if (tracker != null) // { // tracker.registerObject(element.getDeclaringExtension(), // new DirtyPerspectiveMarker(id), IExtensionTracker.REF_STRONG); // } return this->ProcessExtension(element); } return true; } return false; }
bool PerspectiveRegistryReader::ReadElement(IConfigurationElement::Pointer element) { if (element->GetName() == WorkbenchRegistryConstants::TAG_PERSPECTIVE) { try { std::string id; element->GetAttribute(WorkbenchRegistryConstants::ATT_ID, id); PerspectiveDescriptor::Pointer desc( new PerspectiveDescriptor(id, element)); registry->AddPerspective(desc); } catch (CoreException e) { // log an error since its not safe to open a dialog here WorkbenchPlugin::Log("Unable to create layout descriptor.", e);//$NON-NLS-1$ } return true; } return false; }
void RegistryReader::LogUnknownElement( IConfigurationElement::Pointer element) { RegistryReader::LogError(element, "Unknown extension tag found: " + element->GetName());//$NON-NLS-1$ }