Java Code Examples for org.eclipse.jdt.internal.ui.JavaPluginImages#get()

The following examples show how to use org.eclipse.jdt.internal.ui.JavaPluginImages#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QuickAssistProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private static boolean getAddElseProposals(IInvocationContext context, ASTNode node, Collection<ICommandAccess> resultingCollections) {
	if (!(node instanceof IfStatement)) {
		return false;
	}
	IfStatement ifStatement= (IfStatement) node;
	if (ifStatement.getElseStatement() != null) {
		return false;
	}

	if (resultingCollections == null) {
		return true;
	}

	AST ast= node.getAST();
	ASTRewrite rewrite= ASTRewrite.create(ast);
	Block body= ast.newBlock();

	rewrite.set(ifStatement, IfStatement.ELSE_STATEMENT_PROPERTY, body, null);

	String label= CorrectionMessages.QuickAssistProcessor_addelseblock_description;
	Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_ADD);
	ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(), rewrite, IProposalRelevance.ADD_ELSE_BLOCK, image);
	resultingCollections.add(proposal);
	return true;
}
 
Example 2
Source File: QuickAssistProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private static boolean getRemoveBlockProposals(IInvocationContext context, ASTNode coveringNode, Collection<ICommandAccess> resultingCollections) {
	IProposableFix[] fixes= ControlStatementsFix.createRemoveBlockFix(context.getASTRoot(), coveringNode);
	if (fixes != null) {
		if (resultingCollections == null) {
			return true;
		}
		Map<String, String> options= new Hashtable<String, String>();
		options.put(CleanUpConstants.CONTROL_STATEMENTS_USE_BLOCKS, CleanUpOptions.TRUE);
		options.put(CleanUpConstants.CONTROL_STATMENTS_USE_BLOCKS_NEVER, CleanUpOptions.TRUE);
		ICleanUp cleanUp= new ControlStatementsCleanUp(options);
		for (int i= 0; i < fixes.length; i++) {
			IProposableFix fix= fixes[i];
			Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
			FixCorrectionProposal proposal= new FixCorrectionProposal(fix, cleanUp, IProposalRelevance.REMOVE_BLOCK_FIX, image, context);
			resultingCollections.add(proposal);
		}
		return true;
	}
	return false;
}
 
Example 3
Source File: QuickAssistProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private static boolean getConvertIterableLoopProposal(IInvocationContext context, ASTNode node, Collection<ICommandAccess> resultingCollections) {
	ForStatement forStatement= getEnclosingForStatementHeader(node);
	if (forStatement == null)
		return false;

	if (resultingCollections == null)
		return true;

	IProposableFix fix= ConvertLoopFix.createConvertIterableLoopToEnhancedFix(context.getASTRoot(), forStatement);
	if (fix == null)
		return false;

	Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
	Map<String, String> options= new HashMap<String, String>();
	options.put(CleanUpConstants.CONTROL_STATMENTS_CONVERT_FOR_LOOP_TO_ENHANCED, CleanUpOptions.TRUE);
	ICleanUp cleanUp= new ConvertLoopCleanUp(options);
	FixCorrectionProposal proposal= new FixCorrectionProposal(fix, cleanUp, IProposalRelevance.CONVERT_ITERABLE_LOOP_TO_ENHANCED, image, context);
	proposal.setCommandId(CONVERT_FOR_LOOP_ID);

	resultingCollections.add(proposal);
	return true;
}
 
Example 4
Source File: QuickAssistProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private static boolean getMakeVariableDeclarationFinalProposals(IInvocationContext context, Collection<ICommandAccess> resultingCollections) {
	SelectionAnalyzer analyzer= new SelectionAnalyzer(Selection.createFromStartLength(context.getSelectionOffset(), context.getSelectionLength()), false);
	context.getASTRoot().accept(analyzer);
	ASTNode[] selectedNodes= analyzer.getSelectedNodes();
	if (selectedNodes.length == 0)
		return false;

	IProposableFix fix= VariableDeclarationFix.createChangeModifierToFinalFix(context.getASTRoot(), selectedNodes);
	if (fix == null)
		return false;

	if (resultingCollections == null)
		return true;

	Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
	Map<String, String> options= new Hashtable<String, String>();
	options.put(CleanUpConstants.VARIABLE_DECLARATIONS_USE_FINAL, CleanUpOptions.TRUE);
	options.put(CleanUpConstants.VARIABLE_DECLARATIONS_USE_FINAL_LOCAL_VARIABLES, CleanUpOptions.TRUE);
	options.put(CleanUpConstants.VARIABLE_DECLARATIONS_USE_FINAL_PARAMETERS, CleanUpOptions.TRUE);
	options.put(CleanUpConstants.VARIABLE_DECLARATIONS_USE_FINAL_PRIVATE_FIELDS, CleanUpOptions.TRUE);
	VariableDeclarationCleanUp cleanUp= new VariableDeclarationCleanUp(options);
	FixCorrectionProposal proposal= new FixCorrectionProposal(fix, cleanUp, IProposalRelevance.MAKE_VARIABLE_DECLARATION_FINAL, image, context);
	resultingCollections.add(proposal);
	return true;
}
 
Example 5
Source File: QuickAssistProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static boolean getInlineLocalProposal(IInvocationContext context, final ASTNode node, Collection<ICommandAccess> proposals) throws CoreException {
	if (!(node instanceof SimpleName))
		return false;

	SimpleName name= (SimpleName) node;
	IBinding binding= name.resolveBinding();
	if (!(binding instanceof IVariableBinding))
		return false;
	IVariableBinding varBinding= (IVariableBinding) binding;
	if (varBinding.isField() || varBinding.isParameter())
		return false;
	ASTNode decl= context.getASTRoot().findDeclaringNode(varBinding);
	if (!(decl instanceof VariableDeclarationFragment) || decl.getLocationInParent() != VariableDeclarationStatement.FRAGMENTS_PROPERTY)
		return false;

	if (proposals == null) {
		return true;
	}

	InlineTempRefactoring refactoring= new InlineTempRefactoring((VariableDeclaration) decl);
	if (refactoring.checkInitialConditions(new NullProgressMonitor()).isOK()) {
		String label= CorrectionMessages.QuickAssistProcessor_inline_local_description;
		Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
		RefactoringCorrectionProposal proposal= new RefactoringCorrectionProposal(label, context.getCompilationUnit(), refactoring, IProposalRelevance.INLINE_LOCAL, image);
		proposal.setCommandId(INLINE_LOCAL_ID);
		proposals.add(proposal);

	}
	return true;
}
 
Example 6
Source File: MarkerResolutionProposal.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public Image getImage() {
	if (fResolution instanceof IMarkerResolution2) {
		return ((IMarkerResolution2) fResolution).getImage();
	}
	if (fResolution instanceof IJavaCompletionProposal) {
		return ((IJavaCompletionProposal) fResolution).getImage();
	}
	return JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
}
 
Example 7
Source File: AdvancedQuickAssistProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static boolean getInverseIfProposals(IInvocationContext context, ASTNode covering, Collection<ICommandAccess> resultingCollections) {
	if (!(covering instanceof IfStatement)) {
		return false;
	}
	IfStatement ifStatement= (IfStatement) covering;
	if (ifStatement.getElseStatement() == null) {
		return false;
	}
	//  we could produce quick assist
	if (resultingCollections == null) {
		return true;
	}
	//
	AST ast= covering.getAST();
	ASTRewrite rewrite= ASTRewrite.create(ast);
	Statement thenStatement= ifStatement.getThenStatement();
	Statement elseStatement= ifStatement.getElseStatement();

	// prepare original nodes
	Expression inversedExpression= getInversedExpression(rewrite, ifStatement.getExpression());

	Statement newElseStatement= (Statement) rewrite.createMoveTarget(thenStatement);
	Statement newThenStatement= (Statement) rewrite.createMoveTarget(elseStatement);
	// set new nodes
	rewrite.set(ifStatement, IfStatement.EXPRESSION_PROPERTY, inversedExpression, null);

	if (elseStatement instanceof IfStatement) {// bug 79507 && bug 74580
		Block elseBlock= ast.newBlock();
		elseBlock.statements().add(newThenStatement);
		newThenStatement= elseBlock;
	}
	rewrite.set(ifStatement, IfStatement.THEN_STATEMENT_PROPERTY, newThenStatement, null);
	rewrite.set(ifStatement, IfStatement.ELSE_STATEMENT_PROPERTY, newElseStatement, null);
	// add correction proposal
	String label= CorrectionMessages.AdvancedQuickAssistProcessor_inverseIf_description;
	Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
	ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(), rewrite, IProposalRelevance.INVERSE_IF_STATEMENT, image);
	resultingCollections.add(proposal);
	return true;
}
 
Example 8
Source File: GetterSetterCorrectionSubProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Proposes a setter for this field.
 * 
 * @param context the proposal parameter
 * @param relevance relevance of this proposal
 * @return the proposal if available or null
 */
private static ChangeCorrectionProposal addSetterProposal(ProposalParameter context, int relevance) {
	boolean isBoolean= isBoolean(context);
	String setterName= GetterSetterUtil.getSetterName(context.variableBinding, context.compilationUnit.getJavaProject(), null, isBoolean);
	ITypeBinding declaringType= context.variableBinding.getDeclaringClass();
	if (declaringType == null)
		return null;

	IMethodBinding method= Bindings.findMethodInHierarchy(declaringType, setterName, new ITypeBinding[] { context.variableBinding.getType() });
	if (method != null && Bindings.isVoidType(method.getReturnType()) && (Modifier.isStatic(method.getModifiers()) == Modifier.isStatic(context.variableBinding.getModifiers()))) {
		Expression assignedValue= getAssignedValue(context);
		if (assignedValue == null)
			return null; //we don't know how to handle those cases.
		Expression mi= createMethodInvocation(context, method, assignedValue);
		context.astRewrite.replace(context.accessNode.getParent(), mi, null);

		String label= Messages.format(CorrectionMessages.GetterSetterCorrectionSubProcessor_replacewithsetter_description, BasicElementLabels.getJavaCodeString(ASTNodes.asString(context.accessNode)));
		Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
		ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, context.compilationUnit, context.astRewrite, relevance, image);
		return proposal;
	} else {
		IJavaElement element= context.variableBinding.getJavaElement();
		if (element instanceof IField) {
			IField field= (IField) element;
			try {
				if (RefactoringAvailabilityTester.isSelfEncapsulateAvailable(field))
					return new SelfEncapsulateFieldProposal(relevance, field);
			} catch (JavaModelException e) {
				JavaPlugin.log(e);
			}
		}
	}
	return null;
}
 
Example 9
Source File: AccessRulesLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public static Image getResolutionImage(int kind) {
	switch (kind) {
		case IAccessRule.K_ACCESSIBLE:
			return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_NLS_TRANSLATE);
		case IAccessRule.K_DISCOURAGED:
			return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_REFACTORING_WARNING);
		case IAccessRule.K_NON_ACCESSIBLE:
			return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_REFACTORING_ERROR);
	}
	return null;
}
 
Example 10
Source File: SuppressWarningsSubProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public SuppressWarningsProposal(String warningToken, String label, ICompilationUnit cu, ASTNode node, ChildListPropertyDescriptor property, int relevance) {
	super(label, cu, null, relevance, JavaPluginImages.get(JavaPluginImages.IMG_OBJS_JAVADOCTAG));
	fWarningToken= warningToken;
	fNode= node;
	fProperty= property;
	setCommandId(ADD_SUPPRESSWARNINGS_ID);
}
 
Example 11
Source File: LocalCorrectionsSubProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public static void addMissingDefaultCaseProposal(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {
	ASTNode selectedNode= problem.getCoveringNode(context.getASTRoot());
	if (selectedNode instanceof Expression && selectedNode.getLocationInParent() == SwitchStatement.EXPRESSION_PROPERTY) {
		SwitchStatement switchStatement= (SwitchStatement) selectedNode.getParent();
		for (Statement statement : (List<Statement>) switchStatement.statements()) {
			if (statement instanceof SwitchCase && ((SwitchCase) statement).isDefault()) {
				return;
			}
		}
		Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
		createMissingDefaultProposal(context, switchStatement, image, proposals);
	}
}
 
Example 12
Source File: LocalCorrectionsSubProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public static void addUnqualifiedFieldAccessProposal(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {
	IProposableFix fix= CodeStyleFix.createAddFieldQualifierFix(context.getASTRoot(), problem);
	if (fix != null) {
		Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
		Map<String, String> options= new HashMap<String, String>();
		options.put(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS, CleanUpOptions.TRUE);
		options.put(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS, CleanUpOptions.TRUE);
		FixCorrectionProposal proposal= new FixCorrectionProposal(fix, new CodeStyleCleanUp(options), IProposalRelevance.ADD_FIELD_QUALIFIER, image, context);
		proposal.setCommandId(ADD_FIELD_QUALIFICATION_ID);
		proposals.add(proposal);
	}
}
 
Example 13
Source File: UnresolvedElementsSubProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private static void addStaticImportFavoriteProposals(IInvocationContext context, SimpleName node, boolean isMethod, Collection<ICommandAccess> proposals) throws JavaModelException {
	IJavaProject project= context.getCompilationUnit().getJavaProject();
	if (JavaModelUtil.is50OrHigher(project)) {
		String pref= PreferenceConstants.getPreference(PreferenceConstants.CODEASSIST_FAVORITE_STATIC_MEMBERS, project);
		String[] favourites= pref.split(";"); //$NON-NLS-1$
		if (favourites.length == 0) {
			return;
		}

		CompilationUnit root= context.getASTRoot();
		AST ast= root.getAST();
		
		String name= node.getIdentifier();
		String[] staticImports= SimilarElementsRequestor.getStaticImportFavorites(context.getCompilationUnit(), name, isMethod, favourites);
		for (int i= 0; i < staticImports.length; i++) {
			String curr= staticImports[i];
			
			ImportRewrite importRewrite= StubUtility.createImportRewrite(root, true);
			ASTRewrite astRewrite= ASTRewrite.create(ast);
			
			String label;
			String qualifiedTypeName= Signature.getQualifier(curr);
			String elementLabel= BasicElementLabels.getJavaElementName(JavaModelUtil.concatenateName(Signature.getSimpleName(qualifiedTypeName), name));
			
			String res= importRewrite.addStaticImport(qualifiedTypeName, name, isMethod, new ContextSensitiveImportRewriteContext(root, node.getStartPosition(), importRewrite));
			int dot= res.lastIndexOf('.');
			if (dot != -1) {
				String usedTypeName= importRewrite.addImport(qualifiedTypeName);
				Name newName= ast.newQualifiedName(ast.newName(usedTypeName), ast.newSimpleName(name));
				astRewrite.replace(node, newName, null);
				label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_change_to_static_import_description, elementLabel);
			} else {
				label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_add_static_import_description, elementLabel);
			}

			Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_IMPDECL);
			ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(), astRewrite, IProposalRelevance.ADD_STATIC_IMPORT, image);
			proposal.setImportRewrite(importRewrite);
			proposals.add(proposal);
		}
	}
}
 
Example 14
Source File: GetterSetterCorrectionSubProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public SelfEncapsulateFieldProposal(int relevance, IField field) {
	super(getDescription(field), null, relevance, JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE));
	fField= field;
	fNoDialog= false;
	setCommandId(SELF_ENCAPSULATE_FIELD_ID);
}
 
Example 15
Source File: AdvancedQuickAssistProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private static boolean getExchangeOperandsProposals(IInvocationContext context, ASTNode node, Collection<ICommandAccess> resultingCollections) {
	// check that user invokes quick assist on infix expression
	if (!(node instanceof InfixExpression)) {
		return false;
	}
	InfixExpression infixExpression= (InfixExpression)node;
	Operator operator= infixExpression.getOperator();
	if (operator != InfixExpression.Operator.CONDITIONAL_AND && operator != InfixExpression.Operator.AND
			&& operator != InfixExpression.Operator.CONDITIONAL_OR && operator != InfixExpression.Operator.OR
			&& operator != InfixExpression.Operator.EQUALS && operator != InfixExpression.Operator.NOT_EQUALS
			&& operator != InfixExpression.Operator.LESS && operator != InfixExpression.Operator.LESS_EQUALS
			&& operator != InfixExpression.Operator.GREATER && operator != InfixExpression.Operator.GREATER_EQUALS
			&& operator != InfixExpression.Operator.PLUS && operator != InfixExpression.Operator.TIMES
			&& operator != InfixExpression.Operator.XOR) {
		return false;
	}

	int offset= isOperatorSelected(infixExpression, context.getSelectionOffset(), context.getSelectionLength());
	if (offset == -1) {
		return false;
	}

	//  we could produce quick assist
	if (resultingCollections == null) {
		return true;
	}
	AST ast= infixExpression.getAST();
	ASTRewrite rewrite= ASTRewrite.create(ast);
	// prepare left and right expressions
	Expression leftExpression= null;
	Expression rightExpression= null;
	InfixExpression currentExpression= infixExpression;
	leftExpression= combineOperands(rewrite, leftExpression, infixExpression.getLeftOperand(), false, operator);
	if (infixExpression.getRightOperand().getStartPosition() <= context.getSelectionOffset()) {
		leftExpression= combineOperands(rewrite, leftExpression, infixExpression.getRightOperand(), false, operator);
	} else {
		rightExpression= combineOperands(rewrite, rightExpression, infixExpression.getRightOperand(), false, operator);
	}
	for (Iterator<Expression> iter= currentExpression.extendedOperands().iterator(); iter.hasNext();) {
		Expression extendedOperand= iter.next();
		if (extendedOperand.getStartPosition() <= context.getSelectionOffset()) {
			leftExpression= combineOperands(rewrite, leftExpression, extendedOperand, false, operator);
		} else {
			rightExpression= combineOperands(rewrite, rightExpression, extendedOperand, false, operator);
		}
	}

	if (NecessaryParenthesesChecker.needsParentheses(leftExpression, infixExpression, InfixExpression.RIGHT_OPERAND_PROPERTY)) {
		leftExpression= getParenthesizedExpression(ast, leftExpression);
	}
	if (NecessaryParenthesesChecker.needsParentheses(rightExpression, infixExpression, InfixExpression.LEFT_OPERAND_PROPERTY)) {
		rightExpression= getParenthesizedExpression(ast, rightExpression);
	}

	if (operator == InfixExpression.Operator.LESS) {
		operator= InfixExpression.Operator.GREATER;
	} else if (operator == InfixExpression.Operator.LESS_EQUALS) {
		operator= InfixExpression.Operator.GREATER_EQUALS;
	} else if (operator == InfixExpression.Operator.GREATER) {
		operator= InfixExpression.Operator.LESS;
	} else if (operator == InfixExpression.Operator.GREATER_EQUALS) {
		operator= InfixExpression.Operator.LESS_EQUALS;
	}

	// create new infix expression
	InfixExpression newInfix= ast.newInfixExpression();
	newInfix.setOperator(operator);
	newInfix.setLeftOperand(rightExpression);
	newInfix.setRightOperand(leftExpression);
	rewrite.replace(infixExpression, newInfix, null);
	// add correction proposal
	String label= CorrectionMessages.AdvancedQuickAssistProcessor_exchangeOperands_description;
	Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
	ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(), rewrite, IProposalRelevance.EXCHANGE_OPERANDS, image);
	resultingCollections.add(proposal);
	return true;
}
 
Example 16
Source File: JavaAnnotationImageProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private Image getQuickFixImage() {
	if (fgQuickFixImage == null)
		fgQuickFixImage= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_FIXABLE_PROBLEM);
	return fgQuickFixImage;
}
 
Example 17
Source File: ExtractToNullCheckedLocalProposal.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public ExtractToNullCheckedLocalProposal(ICompilationUnit cu, CompilationUnit compilationUnit, SimpleName fieldReference, ASTNode enclosingMethod) {
	super(FixMessages.ExtractToNullCheckedLocalProposal_extractToCheckedLocal_proposalName, cu, null, 100, JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE));
	this.compilationUnit= compilationUnit;
	this.fieldReference= fieldReference;
	this.enclosingMethod= enclosingMethod;
}
 
Example 18
Source File: NewTypeWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public InterfacesListLabelProvider() {
	fInterfaceImage= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_INTERFACE);
}
 
Example 19
Source File: TemplateEngine.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
protected Image getImage() {
	if (fContextType instanceof SWTContextType)
		return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_SWT_TEMPLATE);
	else
		return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_TEMPLATE);
}
 
Example 20
Source File: CastCorrectionProposal.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Creates a cast correction proposal.
 * 
 * @param label the display name of the proposal
 * @param targetCU the compilation unit that is modified
 * @param nodeToCast the node to cast
 * @param castType the type to cast to, may be <code>null</code>
 * @param relevance the relevance of this proposal
 */
public CastCorrectionProposal(String label, ICompilationUnit targetCU, Expression nodeToCast, ITypeBinding castType, int relevance) {
	super(label, targetCU, null, relevance, JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CAST));
	fNodeToCast= nodeToCast;
	fCastType= castType;
	setCommandId(ADD_CAST_ID);
}