Commit 71b8de1e authored by Johannes Roith's avatar Johannes Roith

- Add commands to popup menu

- Fix in RevisionManager.
parent 5948cd74
......@@ -14,7 +14,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.zest.core;bundle-version="1.5.100",
org.eclipse.zest.layouts;bundle-version="1.1.100",
CupReferencedLibraries;bundle-version="1.0.0",
org.eclipse.ui.views;bundle-version="3.7.0"
org.eclipse.ui.views;bundle-version="3.7.0",
org.eclipse.core.expressions;bundle-version="3.4.600"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
......@@ -44,5 +44,87 @@
value="true">
</persistent>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
defaultHandler="de.tum.in.www2.cupplugin.commands.OpenDefinitionHandler"
id="de.tum.in.www2.cupplugin.commands.OpenDefinition"
name="Cup Open Definition">
</command>
<command
defaultHandler="de.tum.in.www2.cupplugin.commands.OpenDeclarationHandler"
id="de.tum.in.www2.cupplugin.commands.OpenDeclaration"
name="Cup Open Declaration">
</command>
<command
defaultHandler="de.tum.in.www2.cupplugin.commands.RenameSymbolHandler"
id="de.tum.in.www2.cupplugin.commands.RenameSymbol"
name="Cup Rename Symbol">
</command>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="true"
locationURI="popup:org.eclipse.ui.popup.any">
<command
commandId="de.tum.in.www2.cupplugin.commands.OpenDefinition"
style="push">
<visibleWhen
checkEnabled="false">
<iterate
ifEmpty="false"
operator="or">
<and>
<with
variable="selection">
<instanceof
value="org.eclipse.jface.text.TextSelection">
</instanceof>
</with>
</and>
</iterate>
</visibleWhen>
</command>
<command
commandId="de.tum.in.www2.cupplugin.commands.OpenDeclaration"
style="push">
<visibleWhen
checkEnabled="false">
<iterate
ifEmpty="false"
operator="or">
<and>
<with
variable="selection">
<instanceof
value="org.eclipse.jface.text.TextSelection">
</instanceof>
</with>
</and>
</iterate>
</visibleWhen>
</command>
<command
commandId="de.tum.in.www2.cupplugin.commands.RenameSymbol"
style="push">
<visibleWhen
checkEnabled="false">
<iterate
ifEmpty="false"
operator="or">
<and>
<with
variable="selection">
<instanceof
value="org.eclipse.jface.text.TextSelection">
</instanceof>
</with>
</and>
</iterate>
</visibleWhen>
</command>
</menuContribution>
</extension>
</plugin>
package de.tum.in.www2.cupplugin.commands;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import de.tum.in.www2.cupplugin.controller.PluginUtility;
public class OpenDeclarationHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
PluginUtility.showMessage("OpenDeclarationHandler command called!");
return null;
}
}
package de.tum.in.www2.cupplugin.commands;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import de.tum.in.www2.cupplugin.controller.PluginUtility;
public class OpenDefinitionHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
PluginUtility.showMessage("OpenDefinitionHandler command called!");
return null;
}
}
package de.tum.in.www2.cupplugin.commands;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import de.tum.in.www2.cupplugin.controller.PluginUtility;
public class RenameSymbolHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
PluginUtility.showMessage("RenameSymbolHandler command called!");
return null;
}
}
......@@ -20,14 +20,16 @@ public final class RevisionManager {
return 0;
return map.get(doc);
}
public static void increment(IDocument doc) {
public static long increment(IDocument doc) {
if (doc == null)
return;
return 0;
long current = 0;
if (map.containsKey(doc))
current = map.get(doc);
map.put(doc, current+1);
long newValue = current+1;
map.put(doc, newValue);
return newValue;
}
}
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