| /** |
| * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * 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: |
| * Florian Pirchner - Initial implementation |
| * |
| * generated by Xtext 2.11.0 |
| */ |
| package org.eclipse.osbp.xtext.oxtype.ui.quickfix; |
| |
| import org.eclipse.osbp.xtext.oxtype.oxtype.OXImportDeclaration; |
| import org.eclipse.xtext.util.IAcceptor; |
| import org.eclipse.xtext.xbase.ui.quickfix.JavaTypeQuickfixes; |
| import org.eclipse.xtext.xtype.XImportDeclaration; |
| import org.eclipse.xtext.xtype.XImportSection; |
| |
| @SuppressWarnings("restriction") |
| public class CustomJavaTypeQuickfixes extends JavaTypeQuickfixes { |
| |
| protected void parseImportSection(XImportSection importSection, |
| IAcceptor<String> visiblePackages, IAcceptor<String> importedTypes) { |
| for (XImportDeclaration importDeclaration : importSection |
| .getImportDeclarations()) { |
| if (!importDeclaration.isStatic()) { |
| |
| // do not use fqn imports |
| if (importDeclaration instanceof OXImportDeclaration) { |
| OXImportDeclaration oxImportDecl = (OXImportDeclaration) importDeclaration; |
| if (oxImportDecl.isFqnImport()) { |
| continue; |
| } |
| } |
| |
| if (importDeclaration.getImportedNamespace() != null) { |
| String importedAsString = importDeclaration |
| .getImportedNamespace(); |
| if (importDeclaration.isWildcard()) { |
| importedAsString = importedAsString.substring(0, |
| importedAsString.length() - 2); |
| visiblePackages.accept(importedAsString); |
| } else { |
| importedTypes.accept(importedAsString); |
| } |
| } else { |
| importedTypes.accept(importDeclaration |
| .getImportedTypeName()); |
| } |
| } |
| } |
| } |
| } |