Commit 70bcd1b3 authored by Adam Knapp's avatar Adam Knapp
Browse files

Adding quick fix generator (issue #454)


Signed-off-by: Adam Knapp's avatarAdam Knapp <adam.knapp@ericsson.com>
parent 7f564867
......@@ -973,6 +973,17 @@
<type name="org.eclipse.titan.inactive_code">
</type>
</extension>
<extension point="org.eclipse.ui.ide.markerResolution"><!-- TODO: not working yet -->
<markerResolutionGenerator
markerType="org.eclipse.titan.designer.ontheflySyntacticMarker"
class="org.eclipse.titan.designer.editors.actions.QuickFixGenerator" />
<markerResolutionGenerator
markerType="org.eclipse.titan.designer.ontheflySemanticMarker"
class="org.eclipse.titan.designer.editors.actions.QuickFixGenerator" />
<markerResolutionGenerator
markerType="org.eclipse.titan.designer.ontheflyMixedMarker"
class="org.eclipse.titan.designer.editors.actions.QuickFixGenerator" />
</extension>
<extension point="org.eclipse.ui.editors.markerAnnotationSpecification">
<specification
annotationType="org.eclipse.titan.designer.compilerErrorMarkerAnnotationType"
......
/******************************************************************************
* Copyright (c) 2000-2021 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
******************************************************************************/
package org.eclipse.titan.designer.editors.actions;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.titan.designer.editors.controls.HoverProposal;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolutionGenerator;
public final class QuickFixGenerator implements IMarkerResolutionGenerator {
public IMarkerResolution[] getResolutions(IMarker mk) {
try {
Object proposalList = mk.getAttribute(HoverProposal.PROPOSAL);
if (proposalList instanceof IMarkerResolution[]) {
return (IMarkerResolution[]) proposalList;
} else {
return new IMarkerResolution[0];
}
}
catch (CoreException e) {
return new IMarkerResolution[0];
}
}
}
......@@ -12,7 +12,7 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ui.IMarkerResolution;
public class HoverProposal implements IMarkerResolution {
public static String PROPOSAL = "proposal";
public static final String PROPOSAL = "proposal";
private String label;
......
......@@ -154,7 +154,9 @@ public class Ttcn3HoverInfoControl extends AbstractInformationControl implements
tb.setForeground(fShell.getDisplay().getSystemColor(SWT.COLOR_LINK_FOREGROUND));
switchAction.setText(getButtonText());
toolbar.add(switchAction);
if (toolbar.getItems().length == 0) {
toolbar.add(switchAction);
}
tb.setSize(SWT.DEFAULT, 30);
toolbar.update(true);
toolbarTextSize = tb.getSize().x;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment