Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM Corporation - initial API and implementation /
package org.eclipse.pde.internal.ua.ui.editor.cheatsheet.simple;
SimpleCSHyperlinkDetector

Parameters:
page
		super(page);
	}
	/* (non-Javadoc)
	 * @see org.eclipse.pde.internal.ui.editor.PDEHyperlinkDetector#detectAttributeHyperlink(org.eclipse.pde.internal.core.text.IDocumentAttributeNode)
	 */
		// Get the attribute value
		String attributeValue = attribute.getAttributeValue();
		// Ensure the value is defined
		if (PDETextHelper.isDefinedAfterTrim(attributeValue) == false) {
			return null;
		}
		// Get attribute parent
		// Ensure the node is defined
		if (node == null) {
			return null;
else if ((node instanceof SimpleCSObject) == false) {
			return null;
		}
		SimpleCSObject csObject = (SimpleCSObjectnode;
		ISimpleCSModel model = csObject.getModel();
		// Ensure the model is editable
		if (model.isEditable() == false) {
			return null;
		}
		// Get the underlying model resource
		IResource resource = model.getUnderlyingResource();
		// Create the link region
		IRegion linkRegion = new Region(attribute.getValueOffset(), attribute.getValueLength());
		// Create the link container
		IHyperlink[] link = new IHyperlink[1];
		// Create the appropriate resource hyperlink
		if (csObject.getType() == .) {
			// Item
				// Href
				link[0] = new ResourceHyperlink(linkRegionattributeValueresource);
			}
else if (csObject.getType() == .) {
			// Intro
				// Href
				link[0] = new ResourceHyperlink(linkRegionattributeValueresource);
			}
		}
		// If the link is defined return it
		if (link[0] != null) {
			return link;
		}
		return null;
	}
New to GrepCode? Check out our FAQ X