diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/WorkbenchPartAdapterFactory.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/WorkbenchPartAdapterFactory.java | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/WorkbenchPartAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/WorkbenchPartAdapterFactory.java deleted file mode 100644 index daa9aa2a1b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/WorkbenchPartAdapterFactory.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.ui.internal.selection; - -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.jpt.ui.internal.views.JpaDetailsView; -import org.eclipse.jpt.ui.internal.views.structure.JpaStructureView; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.texteditor.ITextEditor; - -/** - * Factory to build adapters for a workbench part: - * - JPA selection participant (if the editor part is a text editor etc.) - * - * See org.eclipse.jpt.ui plugin.xml. - */ -public class WorkbenchPartAdapterFactory - implements IAdapterFactory -{ - private static final Class<?>[] ADAPTER_LIST = new Class[] { JpaSelectionParticipant.class }; - - public Class<?>[] getAdapterList() { - return ADAPTER_LIST; - } - - public Object getAdapter(Object adaptableObject, @SuppressWarnings("unchecked") Class adapterType) { - if (adaptableObject instanceof IWorkbenchPart) { - return this.getAdapter((IWorkbenchPart) adaptableObject, adapterType); - } - return null; - } - - private Object getAdapter(IWorkbenchPart workbenchPart, Class<?> adapterType) { - if (adapterType == JpaSelectionParticipant.class) { - return this.buildJpaSelectionParticipant(workbenchPart); - } - return null; - } - - private JpaSelectionParticipant buildJpaSelectionParticipant(IWorkbenchPart workbenchPart) { - JpaSelectionManager selectionManager = SelectionManagerFactory.getSelectionManager(workbenchPart.getSite().getWorkbenchWindow()); - if (workbenchPart instanceof ITextEditor) { - return new TextEditorSelectionParticipant(selectionManager, (ITextEditor) workbenchPart); - } - if (workbenchPart instanceof JpaStructureView) { - return new JpaStructureSelectionParticipant(selectionManager, (JpaStructureView) workbenchPart); - } - if (workbenchPart instanceof JpaDetailsView) { - return new JpaDetailsSelectionParticipant((JpaDetailsView) workbenchPart); - } - return null; - } - -} |