org.eclipse.jdt.internal.ui.JavaPluginImages Java Examples

The following examples show how to use org.eclipse.jdt.internal.ui.JavaPluginImages. 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: ReturnTypeReplaceModification.java    From sarl with Apache License 2.0 6 votes vote down vote up
/** Create the quick fix if needed.
 *
 * <p>User data contains the name of the expected type.
 *
 * @param provider the quick fix provider.
 * @param issue the issue to fix.
 * @param acceptor the quick fix acceptor.
 */
public static void accept(SARLQuickfixProvider provider, Issue issue, IssueResolutionAcceptor acceptor) {
	final String[] data = issue.getData();
	if (data != null && data.length > 0) {
		final String expectedType = data[0];
		final ReturnTypeReplaceModification modification = new ReturnTypeReplaceModification(expectedType);
		modification.setIssue(issue);
		modification.setTools(provider);
		acceptor.accept(issue,
				MessageFormat.format(Messages.SARLQuickfixProvider_15, expectedType),
				Messages.SARLQuickfixProvider_16,
				JavaPluginImages.IMG_CORRECTION_CHANGE,
				modification,
				IProposalRelevance.CHANGE_RETURN_TYPE);
	}
}
 
Example #2
Source File: ClasspathContainerSelectionPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Constructor for ClasspathContainerWizardPage.
 * 
 * @param containerPages the array of container pages
 */
protected ClasspathContainerSelectionPage(ClasspathContainerDescriptor[] containerPages) {
	super("ClasspathContainerWizardPage"); //$NON-NLS-1$
	setTitle(NewWizardMessages.ClasspathContainerSelectionPage_title);
	setDescription(NewWizardMessages.ClasspathContainerSelectionPage_description);
	setImageDescriptor(JavaPluginImages.DESC_WIZBAN_ADD_LIBRARY);

	fContainers= containerPages;

	IDialogSettings settings= JavaPlugin.getDefault().getDialogSettings();
	fDialogSettings= settings.getSection(DIALOGSTORE_SECTION);
	if (fDialogSettings == null) {
		fDialogSettings= settings.addNewSection(DIALOGSTORE_SECTION);
		fDialogSettings.put(DIALOGSTORE_CONTAINER_IDX, 0);
	}
	validatePage();
}
 
Example #3
Source File: JavaElementImageDescriptor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void drawBottomLeft() {
	Point pos= new Point(0, getSize().y);
	if ((fFlags & ERROR) != 0) {
		addBottomLeftImage(JavaPluginImages.DESC_OVR_ERROR, pos);
	}
	if ((fFlags & BUILDPATH_ERROR) != 0) {
		addBottomLeftImage(JavaPluginImages.DESC_OVR_BUILDPATH_ERROR, pos);
	}
	if ((fFlags & WARNING) != 0) {
		addBottomLeftImage(JavaPluginImages.DESC_OVR_WARNING, pos);
	}
	if ((fFlags & IGNORE_OPTIONAL_PROBLEMS) != 0) {
		addBottomLeftImage(JavaPluginImages.DESC_OVR_IGNORE_OPTIONAL_PROBLEMS, pos);
	}

}
 
Example #4
Source File: PropertiesQuickAssistProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private static boolean getRenameKeysProposals(PropertiesAssistContext invocationContext, ArrayList<ICompletionProposal> resultingCollections)
		throws BadLocationException, BadPartitioningException {
	ISourceViewer sourceViewer= invocationContext.getSourceViewer();
	IDocument document= invocationContext.getDocument();
	int selectionOffset= invocationContext.getOffset();
	int selectionLength= invocationContext.getLength();
	IField field= null;

	IType accessorClass= invocationContext.getAccessorType();
	if (accessorClass == null || !isEclipseNLSUsed(accessorClass))
		return false;

	List<String> keys= getKeysFromSelection(document, selectionOffset, selectionLength);
	if (keys == null || keys.size() != 1)
		return false;

	field= accessorClass.getField(keys.get(0));
	if (!field.exists())
		return false;
	if (resultingCollections == null)
		return true;

	String name= PropertiesFileEditorMessages.PropertiesCorrectionProcessor_rename_in_workspace;
	resultingCollections.add(new RenameKeyProposal(name, 5, JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE), field, sourceViewer.getTextWidget().getShell()));
	return true;
}
 
Example #5
Source File: BindingLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private static ImageDescriptor getTypeImageDescriptor(boolean inner, ITypeBinding binding, int flags) {
	if (binding.isEnum())
		return JavaPluginImages.DESC_OBJS_ENUM;
	else if (binding.isAnnotation())
		return JavaPluginImages.DESC_OBJS_ANNOTATION;
	else if (binding.isInterface()) {
		if ((flags & JavaElementImageProvider.LIGHT_TYPE_ICONS) != 0)
			return JavaPluginImages.DESC_OBJS_INTERFACEALT;
		if (inner)
			return getInnerInterfaceImageDescriptor(binding.getModifiers());
		return getInterfaceImageDescriptor(binding.getModifiers());
	} else if (binding.isClass()) {
		if ((flags & JavaElementImageProvider.LIGHT_TYPE_ICONS) != 0)
			return JavaPluginImages.DESC_OBJS_CLASSALT;
		if (inner)
			return getInnerClassImageDescriptor(binding.getModifiers());
		return getClassImageDescriptor(binding.getModifiers());
	} else if (binding.isTypeVariable()) {
		return JavaPluginImages.DESC_OBJS_TYPEVARIABLE;
	}
	// primitive type, wildcard
	return null;
}
 
Example #6
Source File: JavaPackageFragmentRootCompletionProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private ICompletionProposal[] createPackagesProposals(int documentOffset, String input) {
	ArrayList<JavaCompletionProposal> proposals= new ArrayList<JavaCompletionProposal>();
	String prefix= input.substring(0, documentOffset);
	try {
		IJavaElement[] packageFragments= fPackageFragmentRoot.getChildren();
		for (int i= 0; i < packageFragments.length; i++) {
			IPackageFragment pack= (IPackageFragment) packageFragments[i];
			String packName= pack.getElementName();
			if (packName.length() == 0 || ! packName.startsWith(prefix))
				continue;
			Image image= getImage(JavaPluginImages.DESC_OBJS_PACKAGE);
			JavaCompletionProposal proposal= new JavaCompletionProposal(packName, 0, input.length(), image, packName, 0);
			proposals.add(proposal);
		}
	} catch (JavaModelException e) {
		JavaPlugin.log(e);
	}
	return proposals.toArray(new ICompletionProposal[proposals.size()]);
}
 
Example #7
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 #8
Source File: ActionAddModification.java    From sarl with Apache License 2.0 6 votes vote down vote up
/** Create the quick fix if needed.
 *
 * <p>The user data contains the name of the container type, and the name of the new action.
 *
 * @param provider the quick fix provider.
 * @param issue the issue to fix.
 * @param acceptor the quick fix acceptor.
 */
public static void accept(SARLQuickfixProvider provider, Issue issue, IssueResolutionAcceptor acceptor) {
	final String[] data = issue.getData();
	if (data != null && data.length > 1) {
		final String actionName = data[1];
		final ActionAddModification modification = new ActionAddModification(actionName);
		modification.setIssue(issue);
		modification.setTools(provider);
		acceptor.accept(issue,
				MessageFormat.format(Messages.SARLQuickfixProvider_2, actionName),
				MessageFormat.format(Messages.SARLQuickfixProvider_3, actionName),
				JavaPluginImages.IMG_CORRECTION_ADD,
				modification,
				IProposalRelevance.ADD_UNIMPLEMENTED_METHODS);
	}
}
 
Example #9
Source File: QuickAssistProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private static boolean getConvertForLoopProposal(IInvocationContext context, ASTNode node, Collection<ICommandAccess> resultingCollections) {
	ForStatement forStatement= getEnclosingForStatementHeader(node);
	if (forStatement == null)
		return false;

	if (resultingCollections == null)
		return true;

	IProposableFix fix= ConvertLoopFix.createConvertForLoopToEnhancedFix(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_FOR_LOOP_TO_ENHANCED, image, context);
	proposal.setCommandId(CONVERT_FOR_LOOP_ID);

	resultingCollections.add(proposal);
	return true;
}
 
Example #10
Source File: LocalCorrectionsSubProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private static ASTRewriteCorrectionProposal createNoSideEffectProposal(IInvocationContext context, SimpleName nodeToQualify, IVariableBinding fieldBinding, String label, int relevance) {
	AST ast= nodeToQualify.getAST();

	Expression qualifier;
	if (Modifier.isStatic(fieldBinding.getModifiers())) {
		ITypeBinding declaringClass= fieldBinding.getDeclaringClass();
		qualifier= ast.newSimpleName(declaringClass.getTypeDeclaration().getName());
	} else {
		qualifier= ast.newThisExpression();
	}

	ASTRewrite rewrite= ASTRewrite.create(ast);
	FieldAccess access= ast.newFieldAccess();
	access.setName((SimpleName) rewrite.createCopyTarget(nodeToQualify));
	access.setExpression(qualifier);
	rewrite.replace(nodeToQualify, access, null);


	Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
	return new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(), rewrite, relevance, image);
}
 
Example #11
Source File: ImplementedTypeRemoveModification.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Create the quick fix if needed.
 *
 * <p>The first user data is the name of the type to remove.
 * The second parameter may be the type of the removal (see {@link RemovalType}).
 *
 * @param provider the quick fix provider.
 * @param issue the issue to fix.
 * @param acceptor the quick fix acceptor.
 * @param type the type of the modification.
 */
public static void accept(SARLQuickfixProvider provider, Issue issue, IssueResolutionAcceptor acceptor, RemovalType type) {
	final String[] data = issue.getData();
	RemovalType removalType = type;
	String redundantName = null;
	if (data != null && data.length >= 1) {
		redundantName = data[0];
		if (removalType == null && data.length >= 2) {
			final String mode = data[1];
			if (!Strings.isNullOrEmpty(mode)) {
				try {
					removalType = RemovalType.valueOf(mode.toUpperCase());
				} catch (Throwable exception) {
					//
				}
			}
		}
	}
	if (removalType == null) {
		removalType = RemovalType.OTHER;
	}
	final String msg;
	if (Strings.isNullOrEmpty(redundantName)) {
		msg = Messages.SARLQuickfixProvider_0;
	} else {
		msg = MessageFormat.format(Messages.SARLQuickfixProvider_6, redundantName);
	}

	final ImplementedTypeRemoveModification modification = new ImplementedTypeRemoveModification(removalType);
	modification.setIssue(issue);
	modification.setTools(provider);
	acceptor.accept(issue,
			msg,
			Messages.SARLQuickfixProvider_9,
			JavaPluginImages.IMG_CORRECTION_REMOVE,
			modification);
}
 
Example #12
Source File: AdvancedQuickAssistProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static boolean getPullNegationUpProposals(IInvocationContext context, ArrayList<ASTNode> coveredNodes, Collection<ICommandAccess> resultingCollections) {
	if (coveredNodes.size() != 1) {
		return false;
	}
	//
	ASTNode fullyCoveredNode= coveredNodes.get(0);

	Expression expression= getBooleanExpression(fullyCoveredNode);
	if (expression == null || (!(expression instanceof InfixExpression) && !(expression instanceof ConditionalExpression))) {
		return false;
	}
	//  we could produce quick assist
	if (resultingCollections == null) {
		return true;
	}
	//
	AST ast= expression.getAST();
	final ASTRewrite rewrite= ASTRewrite.create(ast);
	// prepared inverted expression
	Expression inversedExpression= getInversedExpression(rewrite, expression);
	// prepare ParenthesizedExpression
	ParenthesizedExpression parenthesizedExpression= ast.newParenthesizedExpression();
	parenthesizedExpression.setExpression(inversedExpression);
	// prepare NOT prefix expression
	PrefixExpression prefixExpression= ast.newPrefixExpression();
	prefixExpression.setOperator(PrefixExpression.Operator.NOT);
	prefixExpression.setOperand(parenthesizedExpression);
	// replace old expression
	rewrite.replace(expression, prefixExpression, null);
	// add correction proposal
	String label= CorrectionMessages.AdvancedQuickAssistProcessor_pullNegationUp;
	Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
	ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(), rewrite, IProposalRelevance.PULL_NEGATION_UP, image);
	resultingCollections.add(proposal);
	return true;
}
 
Example #13
Source File: CPVariableElementLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public CPVariableElementLabelProvider(boolean highlightReadOnly) {
	ImageRegistry reg= JavaPlugin.getDefault().getImageRegistry();
	fJARImage= reg.get(JavaPluginImages.IMG_OBJS_EXTJAR);
	fFolderImage= PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);

	fDeprecatedJARImage= new DecorationOverlayIcon(fJARImage, JavaPluginImages.DESC_OVR_DEPRECATED, IDecoration.TOP_LEFT).createImage();
	fDeprecatedFolderImage= new DecorationOverlayIcon(fFolderImage, JavaPluginImages.DESC_OVR_DEPRECATED, IDecoration.TOP_LEFT).createImage();

	fHighlightReadOnly= highlightReadOnly;
}
 
Example #14
Source File: OpenNewClassWizardAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates an instance of the <code>OpenNewClassWizardAction</code>.
 */
public OpenNewClassWizardAction() {
	setText(ActionMessages.OpenNewClassWizardAction_text);
	setDescription(ActionMessages.OpenNewClassWizardAction_description);
	setToolTipText(ActionMessages.OpenNewClassWizardAction_tooltip);
	setImageDescriptor(JavaPluginImages.DESC_WIZBAN_NEWCLASS);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.OPEN_CLASS_WIZARD_ACTION);

	fPage= null;
	fOpenEditorOnFinish= true;
}
 
Example #15
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 #16
Source File: TypeNameMatchLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public static ImageDescriptor getImageDescriptor(TypeNameMatch typeRef, int flags) {
	if (isSet(SHOW_TYPE_CONTAINER_ONLY, flags)) {
		if (typeRef.getPackageName().equals(typeRef.getTypeContainerName()))
			return JavaPluginImages.DESC_OBJS_PACKAGE;

		// XXX cannot check outer type for interface efficiently (5887)
		return JavaPluginImages.DESC_OBJS_CLASS;

	} else if (isSet(SHOW_PACKAGE_ONLY, flags)) {
		return JavaPluginImages.DESC_OBJS_PACKAGE;
	} else {
		boolean isInner= typeRef.getTypeContainerName().indexOf('.') != -1;
		int modifiers= typeRef.getModifiers();

		ImageDescriptor desc= JavaElementImageProvider.getTypeImageDescriptor(isInner, false, modifiers, false);
		int adornmentFlags= 0;
		if (Flags.isFinal(modifiers)) {
			adornmentFlags |= JavaElementImageDescriptor.FINAL;
		}
		if (Flags.isAbstract(modifiers) && !Flags.isInterface(modifiers)) {
			adornmentFlags |= JavaElementImageDescriptor.ABSTRACT;
		}
		if (Flags.isStatic(modifiers)) {
			adornmentFlags |= JavaElementImageDescriptor.STATIC;
		}
		if (Flags.isDeprecated(modifiers)) {
			adornmentFlags |= JavaElementImageDescriptor.DEPRECATED;
		}

		return new JavaElementImageDescriptor(desc, adornmentFlags, JavaElementImageProvider.BIG_SIZE);
	}
}
 
Example #17
Source File: UnresolvedElementsSubProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static void addNewFieldForType(ICompilationUnit targetCU, ITypeBinding binding, ITypeBinding senderDeclBinding, SimpleName simpleName, boolean isWriteAccess, boolean mustBeConst, Collection<ICommandAccess> proposals) {
	String name= simpleName.getIdentifier();
	String nameLabel= BasicElementLabels.getJavaElementName(name);
	String label;
	Image image;
	if (senderDeclBinding.isEnum() && !isWriteAccess) {
		label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_createenum_description, new Object[] { nameLabel, ASTResolving.getTypeSignature(senderDeclBinding) });
		image= JavaPluginImages.get(JavaPluginImages.IMG_FIELD_PUBLIC);
		proposals.add(new NewVariableCorrectionProposal(label, targetCU, NewVariableCorrectionProposal.ENUM_CONST, simpleName, senderDeclBinding, 10, image));
	} else {
		if (!mustBeConst) {
			if (binding == null) {
				label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_createfield_description, nameLabel);
				image= JavaPluginImages.get(JavaPluginImages.IMG_FIELD_PRIVATE);
			} else {
				label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_createfield_other_description, new Object[] { nameLabel, ASTResolving.getTypeSignature(senderDeclBinding) } );
				image= JavaPluginImages.get(JavaPluginImages.IMG_FIELD_PUBLIC);
			}
			int fieldRelevance= StubUtility.hasFieldName(targetCU.getJavaProject(), name) ? IProposalRelevance.CREATE_FIELD_PREFIX_OR_SUFFIX_MATCH : IProposalRelevance.CREATE_FIELD;
			proposals.add(new NewVariableCorrectionProposal(label, targetCU, NewVariableCorrectionProposal.FIELD, simpleName, senderDeclBinding, fieldRelevance, image));
		}

		if (!isWriteAccess && !senderDeclBinding.isAnonymous()) {
			if (binding == null) {
				label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_createconst_description, nameLabel);
				image= JavaPluginImages.get(JavaPluginImages.IMG_FIELD_PRIVATE);
			} else {
				label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_createconst_other_description, new Object[] { nameLabel, ASTResolving.getTypeSignature(senderDeclBinding) } );
				image= JavaPluginImages.get(JavaPluginImages.IMG_FIELD_PUBLIC);
			}
			int constRelevance= StubUtility.hasConstantName(targetCU.getJavaProject(), name) ? IProposalRelevance.CREATE_CONSTANT_PREFIX_OR_SUFFIX_MATCH : IProposalRelevance.CREATE_CONSTANT;
			proposals.add(new NewVariableCorrectionProposal(label, targetCU, NewVariableCorrectionProposal.CONST_FIELD, simpleName, senderDeclBinding, constRelevance, image));
		}
	}
}
 
Example #18
Source File: JavaCompareUtilities.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
static ImageDescriptor getImageDescriptor(IMember element) {
	int t= element.getElementType();
	if (t == IJavaElement.TYPE) {
		IType type= (IType) element;
		try {
			return getTypeImageDescriptor(type.isClass());
		} catch (CoreException e) {
			JavaPlugin.log(e);
			return JavaPluginImages.DESC_OBJS_GHOST;
		}
	}
	return getImageDescriptor(t);
}
 
Example #19
Source File: SARLDescriptionLabelProviderTest.java    From sarl with Apache License 2.0 5 votes vote down vote up
/**
 * @throws Exception
 */
@Test
public void imageConstructor() throws Exception {
	assertJdtImage(
			JavaPluginImages.DESC_MISC_PUBLIC, JavaElementImageDescriptor.CONSTRUCTOR,
			this.provider.image(mockMember(SarlConstructor.class, JvmVisibility.PUBLIC)));
}
 
Example #20
Source File: JavaTemplatesPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Image getImage(Template template) {
	String contextId= template.getContextTypeId();
	if (SWTContextType.ID_ALL.equals(contextId) || SWTContextType.ID_STATEMENTS.equals(contextId) || SWTContextType.ID_MEMBERS.equals(contextId))
		return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_SWT_TEMPLATE);
	return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_TEMPLATE);
}
 
Example #21
Source File: BindingLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static ImageDescriptor getInnerInterfaceImageDescriptor(int modifiers) {
	if (Modifier.isPublic(modifiers))
		return JavaPluginImages.DESC_OBJS_INNER_INTERFACE_PUBLIC;
	else if (Modifier.isPrivate(modifiers))
		return JavaPluginImages.DESC_OBJS_INNER_INTERFACE_PRIVATE;
	else if (Modifier.isProtected(modifiers))
		return JavaPluginImages.DESC_OBJS_INNER_INTERFACE_PROTECTED;
	else
		return JavaPluginImages.DESC_OBJS_INTERFACE_DEFAULT;
}
 
Example #22
Source File: FindReadReferencesInHierarchyAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
void init() {
	setText(SearchMessages.Search_FindReadReferencesInHierarchyAction_label);
	setToolTipText(SearchMessages.Search_FindReadReferencesInHierarchyAction_tooltip);
	setImageDescriptor(JavaPluginImages.DESC_OBJS_SEARCH_REF);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.FIND_READ_REFERENCES_IN_HIERARCHY_ACTION);
}
 
Example #23
Source File: CorrectMainTypeNameProposal.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Constructor for CorrectTypeNameProposal.
 * @param cu the compilation unit
 * @param context the invocation context
 * @param oldTypeName the old type name
 * @param newTypeName the new type name
 * @param relevance the relevance
 */
public CorrectMainTypeNameProposal(ICompilationUnit cu, IInvocationContext context, String oldTypeName, String newTypeName, int relevance) {
	super("", cu, null, relevance, null); //$NON-NLS-1$
	fContext= context;

	setDisplayName(Messages.format(CorrectionMessages.ReorgCorrectionsSubProcessor_renametype_description, BasicElementLabels.getJavaElementName(newTypeName)));
	setImage(JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE));

	fOldName= oldTypeName;
	fNewName= newTypeName;
}
 
Example #24
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 #25
Source File: BehaviorUnitGuardRemoveModification.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Create the quick fix if needed.
 *
 * @param provider the quick fix provider.
 * @param issue the issue to fix.
 * @param acceptor the quick fix acceptor.
 */
public static void accept(SARLQuickfixProvider provider, Issue issue, IssueResolutionAcceptor acceptor) {
	final BehaviorUnitGuardRemoveModification modification = new BehaviorUnitGuardRemoveModification();
	modification.setIssue(issue);
	modification.setTools(provider);
	acceptor.accept(issue,
			Messages.SARLQuickfixProvider_0,
			Messages.SARLQuickfixProvider_4,
			JavaPluginImages.IMG_CORRECTION_REMOVE,
			modification,
			IProposalRelevance.REMOVE_METHOD_BODY);
}
 
Example #26
Source File: AssignToVariableAssistProposal.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public AssignToVariableAssistProposal(ICompilationUnit cu, SingleVariableDeclaration parameter, VariableDeclarationFragment existingFragment, ITypeBinding typeBinding, int relevance) {
	super("", cu, null, relevance, null); //$NON-NLS-1$

	fVariableKind= FIELD;
	fNodeToAssign= parameter;
	fTypeBinding= typeBinding;
	fExistingFragment= existingFragment;

	if (existingFragment == null) {
		setDisplayName(CorrectionMessages.AssignToVariableAssistProposal_assignparamtofield_description);
	} else {
		setDisplayName(Messages.format(CorrectionMessages.AssignToVariableAssistProposal_assigntoexistingfield_description, BasicElementLabels.getJavaElementName(existingFragment.getName().getIdentifier())));
	}
	setImage(JavaPluginImages.get(JavaPluginImages.IMG_FIELD_PRIVATE));
}
 
Example #27
Source File: AddLibraryToBuildpathAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public AddLibraryToBuildpathAction(IWorkbenchSite site) {
super(site, null, BuildpathModifierAction.ADD_LIB_TO_BP);

setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddLibCP_label);
setImageDescriptor(JavaPluginImages.DESC_OBJS_LIBRARY);
setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddLibCP_tooltip);
  }
 
Example #28
Source File: FindReferencesInHierarchyAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
void init() {
	setText(SearchMessages.Search_FindHierarchyReferencesAction_label);
	setToolTipText(SearchMessages.Search_FindHierarchyReferencesAction_tooltip);
	setImageDescriptor(JavaPluginImages.DESC_OBJS_SEARCH_REF);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.FIND_REFERENCES_IN_HIERARCHY_ACTION);
}
 
Example #29
Source File: ExternalizeWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private Image getNLSImage(int task) {
	switch (task) {
		case NLSSubstitution.EXTERNALIZED :
			return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_NLS_TRANSLATE);
		case NLSSubstitution.IGNORED :
			return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_NLS_NEVER_TRANSLATE);
		case NLSSubstitution.INTERNALIZED :
			return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_NLS_SKIP);
		default :
			Assert.isTrue(false);
			return null;
	}
}
 
Example #30
Source File: SARLContainerWizardPage.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Construct a wizard page for defining the SARL library container.
 */
public SARLContainerWizardPage() {
	super("SARLClassPathContainer"); //$NON-NLS-1$
	setTitle(Messages.SARLClasspathContainer_0);
	setImageDescriptor(JavaPluginImages.DESC_WIZBAN_ADD_LIBRARY);
	setDescription(Messages.SARLContainerWizardPage_0);
	this.containerEntry = JavaCore.newContainerEntry(
			SARLClasspathContainerInitializer.CONTAINER_ID);
}