blob: 772eca165ba8ffe10b2665d3bfd30fe466ebfe7a [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007, 2010 Chase Technology Ltd - http://www.chasetechnology.co.uk
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Doug Satchwell (Chase Technology Ltd) - initial API and implementation
*******************************************************************************/
package org.eclipse.wst.xsl.internal.debug.ui.model;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.wst.xsl.core.XSLCore;
/**
* Creates a toggle breakpoint adapter
*/
public class XSLBreakpointAdapterFactory implements IAdapterFactory {
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adaptableObject instanceof ITextEditor) {
ITextEditor editorPart = (ITextEditor) adaptableObject;
IResource resource = (IResource) editorPart.getEditorInput()
.getAdapter(IResource.class);
if (resource != null && resource instanceof IFile) {
if (XSLCore.isXSLFile((IFile) resource)) {
return new XSLLineBreakpointAdapter();
}
}
}
return null;
}
public Class[] getAdapterList() {
return new Class[] { IToggleBreakpointsTarget.class };
}
}