Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
Revert "correct source formatting (eclipse-mylyn/org.eclipse.mylyn.co…
Browse files Browse the repository at this point in the history
…mmons#18)"

This reverts commit e4b7925.
  • Loading branch information
BeckerFrank committed Nov 29, 2022
1 parent e4b7925 commit 1a742b9
Show file tree
Hide file tree
Showing 111 changed files with 562 additions and 624 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public class CdtStructureBridgeTest extends AbstractCdtContextTest {
protected void setUp() throws Exception {
super.setUp();
importedProject = ResourcesPlugin.getWorkspace().getRoot().getProject("TestProject");
ImportOperation importOperation = new ImportOperation(importedProject.getFullPath(),
new File("data/TestProject/"), new FileSystemStructureProvider(), new IOverwriteQuery() {
public String queryOverwrite(String file) {
return ALL;
}
});
ImportOperation importOperation = new ImportOperation(importedProject.getFullPath(), new File(
"data/TestProject/"), new FileSystemStructureProvider(), new IOverwriteQuery() {
public String queryOverwrite(String file) {
return ALL;
}
});
importOperation.run(null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ public List<String> getChildHandles(String handle) {
}
}
AbstractContextStructureBridge parentBridge = ContextCore.getStructureBridge(parentContentType);
if (parentBridge != null
&& ContextCore.CONTENT_TYPE_RESOURCE.equals(parentBridge.getContentType())) {
if (parentBridge != null && ContextCore.CONTENT_TYPE_RESOURCE.equals(parentBridge.getContentType())) {
// TODO: Make sure line below is correct
if (element.getElementType() < ICElement.C_NAMESPACE) {
List<String> resourceChildren = parentBridge.getChildHandles(handle);
Expand Down Expand Up @@ -203,8 +202,8 @@ public boolean canFilter(Object object) {
Object[] elements = grouping.getChildren(grouping);
if (elements != null) {
for (Object adaptable : elements) {
IInteractionElement element = ContextCore.getContextManager()
.getElement(getHandleIdentifier(adaptable));
IInteractionElement element = ContextCore.getContextManager().getElement(
getHandleIdentifier(adaptable));
if (element != null && element.getInterest().isInteresting()) {
return false;
}
Expand Down Expand Up @@ -248,8 +247,8 @@ public String getHandleForOffsetInObject(Object object, int offset) {
IFile file = (IFile) resource;
if (CoreModel.isValidTranslationUnitName(null, file.getName())) {
ICElement element = CoreModel.getDefault().create(file);
translationUnit = CoreModel.getDefault()
.createTranslationUnitFrom(element.getCProject(), element.getPath());
translationUnit = CoreModel.getDefault().createTranslationUnitFrom(element.getCProject(),
element.getPath());
} else {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ public void open(IInteractionElement node) {
}
EditorUtility.openInEditor(cElement);
} catch (CModelException t) {
StatusHandler.log(new Status(IStatus.ERROR, CDTUIBridgePlugin.ID_PLUGIN,
NLS.bind("Failed to open editor for: {0}", node.getHandleIdentifier()), t)); //$NON-NLS-1$
StatusHandler.log(new Status(IStatus.ERROR, CDTUIBridgePlugin.ID_PLUGIN, NLS.bind(
"Failed to open editor for: {0}", node.getHandleIdentifier()), t)); //$NON-NLS-1$
} catch (PartInitException t) {
StatusHandler.log(new Status(IStatus.ERROR, CDTUIBridgePlugin.ID_PLUGIN,
NLS.bind("Failed to open editor for: {0}", node.getHandleIdentifier()), t)); //$NON-NLS-1$
StatusHandler.log(new Status(IStatus.ERROR, CDTUIBridgePlugin.ID_PLUGIN, NLS.bind(
"Failed to open editor for: {0}", node.getHandleIdentifier()), t)); //$NON-NLS-1$
}
}

Expand Down Expand Up @@ -131,8 +131,8 @@ public List<TreeViewer> getContentOutlineViewers(IEditorPart editorPart) {
try {
viewers.add((TreeViewer) cOutlineField.get(page));
} catch (Exception e) {
StatusHandler.log(
new Status(IStatus.ERROR, CDTUIBridgePlugin.ID_PLUGIN, "Could not get Outline viewer.", e)); //$NON-NLS-1$
StatusHandler.log(new Status(IStatus.ERROR, CDTUIBridgePlugin.ID_PLUGIN,
"Could not get Outline viewer.", e)); //$NON-NLS-1$
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ private void handleDelta(ICElementDelta[] delta) {
}

if (added != null && removed != null) {
IInteractionElement element = ContextCore.getContextManager()
.getElement(CDTStructureBridge.getHandleForElement(removed));
IInteractionElement element = ContextCore.getContextManager().getElement(
CDTStructureBridge.getHandleForElement(removed));
if (element != null) {
resetHandle(element, CDTStructureBridge.getHandleForElement(added));
}
} else if (removed != null) {

IInteractionElement element = ContextCore.getContextManager()
.getElement(CDTStructureBridge.getHandleForElement(removed));
IInteractionElement element = ContextCore.getContextManager().getElement(
CDTStructureBridge.getHandleForElement(removed));
if (element != null) {
delete(element);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public static Set<String> getDisableContentAssistIds(IPreferenceStore cdtPrefs)
public static void updateDefaultPreference(IPreferenceStore cdtPrefs) {
// the Task-Focused category should be disabled if the user reverts to the default
String defaultValue = cdtPrefs.getDefaultString(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES);
cdtPrefs.setDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES,
defaultValue + ASSIST_MYLYN_TYPE + SEPARATOR_CODEASSIST);
cdtPrefs.setDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES, defaultValue + ASSIST_MYLYN_TYPE
+ SEPARATOR_CODEASSIST);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,8 @@ private void handleMacro(IASTPreprocessorMacroDefinition macro, CContentAssistIn
String repString = repStringBuff.toString();
String descString = descStringBuff.toString();

CCompletionProposal proposal = createProposal(repString, descString, prefix.length(), image,
baseRelevance + RelevanceConstants.MACRO_TYPE_RELEVANCE, context, getCElement(macro),
macro.getName().toString());
CCompletionProposal proposal = createProposal(repString, descString, prefix.length(), image, baseRelevance
+ RelevanceConstants.MACRO_TYPE_RELEVANCE, context, getCElement(macro), macro.getName().toString());
if (!context.isContextInformationStyle()) {
proposal.setCursorPosition(repString.length() - 1);
}
Expand All @@ -280,9 +279,8 @@ private void handleMacro(IASTPreprocessorMacroDefinition macro, CContentAssistIn

proposals.add(proposal);
} else {
proposals.add(createProposal(macroName, macroName, prefix.length(), image,
baseRelevance + RelevanceConstants.MACRO_TYPE_RELEVANCE, context, getCElement(macro),
macro.getName().toString()));
proposals.add(createProposal(macroName, macroName, prefix.length(), image, baseRelevance
+ RelevanceConstants.MACRO_TYPE_RELEVANCE, context, getCElement(macro), macro.getName().toString()));
}
}

Expand All @@ -306,22 +304,22 @@ protected void handleBinding(IBinding binding, CContentAssistInvocationContext c
if (binding instanceof IVariable) {
handleVariable((IVariable) binding, cContext, baseRelevance, proposals);
} else if (binding instanceof ITypedef) {
proposals.add(createProposal(name, name, getImage(binding),
baseRelevance + RelevanceConstants.TYPEDEF_TYPE_RELEVANCE, cContext, getCElement(binding),
proposals.add(createProposal(name, name, getImage(binding), baseRelevance
+ RelevanceConstants.TYPEDEF_TYPE_RELEVANCE, cContext, getCElement(binding),
binding.getName()));
} else if (binding instanceof ICPPNamespace) {
handleNamespace((ICPPNamespace) binding, astContext, cContext, baseRelevance, proposals);
} else if (binding instanceof IEnumeration) {
proposals.add(createProposal(name, name, getImage(binding),
baseRelevance + RelevanceConstants.ENUMERATION_TYPE_RELEVANCE, cContext,
getCElement(binding), binding.getName()));
proposals.add(createProposal(name, name, getImage(binding), baseRelevance
+ RelevanceConstants.ENUMERATION_TYPE_RELEVANCE, cContext, getCElement(binding),
binding.getName()));
} else if (binding instanceof IEnumerator) {
proposals.add(createProposal(name, name, getImage(binding),
baseRelevance + RelevanceConstants.ENUMERATOR_TYPE_RELEVANCE, cContext,
getCElement(binding), binding.getName()));
proposals.add(createProposal(name, name, getImage(binding), baseRelevance
+ RelevanceConstants.ENUMERATOR_TYPE_RELEVANCE, cContext, getCElement(binding),
binding.getName()));
} else {
proposals.add(createProposal(name, name, getImage(binding),
baseRelevance + RelevanceConstants.DEFAULT_TYPE_RELEVANCE, cContext, getCElement(binding),
proposals.add(createProposal(name, name, getImage(binding), baseRelevance
+ RelevanceConstants.DEFAULT_TYPE_RELEVANCE, cContext, getCElement(binding),
binding.getName()));
}
}
Expand Down Expand Up @@ -364,13 +362,12 @@ private void handleClass(ICPPClassType classType, IASTCompletionContext astConte
if (astContext instanceof IASTName && !(astContext instanceof ICPPASTQualifiedName)) {
IASTName name = (IASTName) astContext;
if (name.getParent() instanceof IASTDeclarator) {
proposals.add(createProposal(classType.getName() + "::", classType.getName(), getImage(classType), //$NON-NLS-1$
baseRelevance + relevance, context, getCElement(classType), classType.getName()));
proposals.add(createProposal(
classType.getName() + "::", classType.getName(), getImage(classType), baseRelevance + relevance, context, getCElement(classType), classType.getName())); //$NON-NLS-1$
}
}
proposals.add(createProposal(classType.getName(), classType.getName(), getImage(classType),
baseRelevance + RelevanceConstants.CLASS_TYPE_RELEVANCE, context, getCElement(classType),
classType.getName()));
proposals.add(createProposal(classType.getName(), classType.getName(), getImage(classType), baseRelevance
+ RelevanceConstants.CLASS_TYPE_RELEVANCE, context, getCElement(classType), classType.getName()));
}
}

Expand Down Expand Up @@ -455,9 +452,8 @@ private void handleFunction(IFunction function, CContentAssistInvocationContext
final int relevance = function instanceof ICPPMethod
? RelevanceConstants.METHOD_TYPE_RELEVANCE
: RelevanceConstants.FUNCTION_TYPE_RELEVANCE;
CCompletionProposal proposal = createProposal(repString, dispString, idString,
context.getCompletionNode().getLength(), image, baseRelevance + relevance, context,
getCElement(function), function.getName());
CCompletionProposal proposal = createProposal(repString, dispString, idString, context.getCompletionNode()
.getLength(), image, baseRelevance + relevance, context, getCElement(function), function.getName());
if (!context.isContextInformationStyle()) {
proposal.setCursorPosition(repString.length() - 1);
}
Expand Down Expand Up @@ -503,9 +499,8 @@ private void handleVariable(IVariable variable, CContentAssistInvocationContext
: isField(variable)
? RelevanceConstants.FIELD_TYPE_RELEVANCE
: RelevanceConstants.VARIABLE_TYPE_RELEVANCE;
CCompletionProposal proposal = createProposal(repString, dispString, idString,
context.getCompletionNode().getLength(), image, baseRelevance + relevance, context,
getCElement(variable), variable.getName());
CCompletionProposal proposal = createProposal(repString, dispString, idString, context.getCompletionNode()
.getLength(), image, baseRelevance + relevance, context, getCElement(variable), variable.getName());
proposals.add(proposal);
}

Expand Down Expand Up @@ -553,9 +548,8 @@ private void handleNamespace(ICPPNamespace namespace, IASTCompletionContext astC
}

String repString = repStringBuff.toString();
proposals.add(createProposal(repString, namespace.getName(), getImage(namespace),
baseRelevance + RelevanceConstants.NAMESPACE_TYPE_RELEVANCE, cContext, getCElement(namespace),
namespace.getName()));
proposals.add(createProposal(repString, namespace.getName(), getImage(namespace), baseRelevance
+ RelevanceConstants.NAMESPACE_TYPE_RELEVANCE, cContext, getCElement(namespace), namespace.getName()));
}

private ICElement getCElement(ICPPNamespace namespace) {
Expand All @@ -581,8 +575,8 @@ private ICElement getCElement(IASTPreprocessorMacroDefinition macro) {
try {
return getCElement(macro.getFileLocation().getFileName(), macro.getFileLocation().getNodeOffset());
} catch (Exception e) {
StatusHandler.log(
new Status(IStatus.ERROR, CDTUIBridgePlugin.ID_PLUGIN, "Unable to get CElement for Macro", e)); //$NON-NLS-1$
StatusHandler.log(new Status(IStatus.ERROR, CDTUIBridgePlugin.ID_PLUGIN,
"Unable to get CElement for Macro", e)); //$NON-NLS-1$
}
}
return null;
Expand All @@ -604,8 +598,8 @@ private ICElement getCElement(IBinding binding) {
}
if (definition != null && definition.getFileLocation() != null) {
try {
return getCElement(definition.getFileLocation().getFileName(),
definition.getFileLocation().getNodeOffset());
return getCElement(definition.getFileLocation().getFileName(), definition.getFileLocation()
.getNodeOffset());
} catch (CModelException e) {
StatusHandler.log(new Status(IStatus.ERROR, CDTUIBridgePlugin.ID_PLUGIN,
"Unable to get CElement for Binding", e)); //$NON-NLS-1$
Expand Down Expand Up @@ -648,8 +642,7 @@ private CCompletionProposal createProposal(String repString, String dispString,
}

private CCompletionProposal createProposal(String repString, String dispString, String idString, int prefixLength,
Image image, int relevance, CContentAssistInvocationContext context, ICElement element,
String bindingName) {
Image image, int relevance, CContentAssistInvocationContext context, ICElement element, String bindingName) {
int parseOffset = context.getParseOffset();
int invocationOffset = context.getInvocationOffset();
boolean doReplacement = !context.isContextInformationStyle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public List<ICompletionProposal> computeCompletionProposals(ContentAssistInvocat
}

private boolean shouldReturnResults() {
Set<String> disabledIds = CDTContentAssistUtils
.getDisableContentAssistIds(CUIPlugin.getDefault().getPreferenceStore());
Set<String> disabledIds = CDTContentAssistUtils.getDisableContentAssistIds(CUIPlugin.getDefault()
.getPreferenceStore());
if (!disabledIds.contains(CDTContentAssistUtils.ASSIST_CDT_TYPE)) {
// do not return duplicates if the default parser completions is enabled
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ public class ActiveFoldingListener extends AbstractContextListener {

private ICFoldingStructureProvider updater;

private static CDTStructureBridge bridge = (CDTStructureBridge) ContextCore
.getStructureBridge(CDTStructureBridge.CONTENT_TYPE);
private static CDTStructureBridge bridge = (CDTStructureBridge) ContextCore.getStructureBridge(CDTStructureBridge.CONTENT_TYPE);

private boolean enabled = false;

Expand Down Expand Up @@ -137,8 +136,8 @@ public void updateFolding() {
ITranslationUnit compilationUnit = (ITranslationUnit) element;
List<ICElement> allChildren = getAllChildren(compilationUnit);
for (ICElement child : allChildren) {
IInteractionElement interactionElement = ContextCore.getContextManager()
.getElement(bridge.getHandleIdentifier(child));
IInteractionElement interactionElement = ContextCore.getContextManager().getElement(
bridge.getHandleIdentifier(child));
if (interactionElement != null && interactionElement.getInterest().isInteresting()) {
toExpand.add(child);
} else {
Expand All @@ -154,8 +153,7 @@ public void updateFolding() {
editor.getViewer().revealRange(selectedRange.x, selectedRange.y);
}
} catch (Exception e) {
StatusHandler
.log(new Status(IStatus.ERROR, CDTUIBridgePlugin.ID_PLUGIN, "Could not update folding", e)); //$NON-NLS-1$
StatusHandler.log(new Status(IStatus.ERROR, CDTUIBridgePlugin.ID_PLUGIN, "Could not update folding", e)); //$NON-NLS-1$
}
}
}
Expand Down Expand Up @@ -259,9 +257,7 @@ public void contextChanged(ContextChangeEvent event) {
switch (event.getEventKind()) {
case ACTIVATED:
case DEACTIVATED:
if (CDTUIBridgePlugin.getDefault()
.getPreferenceStore()
.getBoolean(CDTUIBridgePlugin.AUTO_FOLDING_ENABLED)) {
if (CDTUIBridgePlugin.getDefault().getPreferenceStore().getBoolean(CDTUIBridgePlugin.AUTO_FOLDING_ENABLED)) {
updateFolding();
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ public void contextChanged(ContextChangeEvent event) {
elementsDeleted(event.getElements());
break;
default:
StatusHandler
.log(new Status(IStatus.ERROR, ContextCorePlugin.ID_PLUGIN, "Unknown context changed event type")); //$NON-NLS-1$
StatusHandler.log(new Status(IStatus.ERROR, ContextCorePlugin.ID_PLUGIN,
"Unknown context changed event type")); //$NON-NLS-1$
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public abstract class ContextComputationStrategy {
/**
* Computes a list of objects that should be added to the context based on the task data.
*/
public abstract List<Object> computeContext(IInteractionContext context, IAdaptable input,
IProgressMonitor monitor);
public abstract List<Object> computeContext(IInteractionContext context, IAdaptable input, IProgressMonitor monitor);

}
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ protected void incrementInterest(IInteractionElement node, String elementKind, S
* Public for testing
*/
public void createEdge(IInteractionElement toNode, String elementKind, String targetHandle) {
CompositeContextElement targetNode = (CompositeContextElement) ContextCore.getContextManager()
.getElement(targetHandle);
CompositeContextElement targetNode = (CompositeContextElement) ContextCore.getContextManager().getElement(
targetHandle);
if (targetNode == null) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ public AggregateInteractionEvent(Kind kind, String structureKind, String handle,
String navigatedRelation, String delta, float interestContribution, Date startDate, Date endDate,
int numCollapsedEvents, int eventCountOnCreation) {

super(kind, structureKind, handle, originId, navigatedRelation, delta, interestContribution, startDate,
endDate);
super(kind, structureKind, handle, originId, navigatedRelation, delta, interestContribution, startDate, endDate);
this.numCollapsedEvents = numCollapsedEvents;
this.eventCountOnCreation = eventCountOnCreation;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ public float getDecayValue() {
* Sums predicted and propagated values
*/
public boolean isPropagated() {
float value = selections * contextScaling.get(InteractionEvent.Kind.SELECTION)
+ edits * contextScaling.get(InteractionEvent.Kind.EDIT);
float value = selections * contextScaling.get(InteractionEvent.Kind.SELECTION) + edits
* contextScaling.get(InteractionEvent.Kind.EDIT);
return value <= 0 && propagatedBias > 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,17 @@ private IInteractionElement parseInteractionEvent(InteractionEvent event) {
numUserEvents += ((AggregateInteractionEvent) event).getNumCollapsedEvents() - 1;
}

if (event.getNavigation() != null && !event.getNavigation().equals("null") && lastEdgeEvent != null //$NON-NLS-1$
if (event.getNavigation() != null
&& !event.getNavigation().equals("null") && lastEdgeEvent != null //$NON-NLS-1$
&& lastEdgeNode != null && lastEdgeEvent.getStructureHandle() != null
&& event.getKind() != InteractionEvent.Kind.PROPAGATION
&& event.getKind() != InteractionEvent.Kind.PREDICTION) {
IInteractionElement navigationSource = elementMap.get(lastEdgeEvent.getStructureHandle());
if (navigationSource != null) {
InteractionContextRelation edge = lastEdgeNode.getRelation(event.getStructureHandle());
if (edge == null) {
edge = new InteractionContextRelation(event.getStructureKind(), event.getNavigation(), lastEdgeNode,
node, this);
edge = new InteractionContextRelation(event.getStructureKind(), event.getNavigation(),
lastEdgeNode, node, this);
lastEdgeNode.addEdge(edge);
}
DegreeOfInterest doi = (DegreeOfInterest) edge.getInterest();
Expand Down
Loading

0 comments on commit 1a742b9

Please sign in to comment.