本文整理汇总了Java中org.eclipse.che.ide.api.action.ActionEvent类的典型用法代码示例。如果您正苦于以下问题:Java ActionEvent类的具体用法?Java ActionEvent怎么用?Java ActionEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionEvent类属于org.eclipse.che.ide.api.action包,在下文中一共展示了ActionEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getEditorFile
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
/**
* Fetch file from the action event. File should be passed by context menu during construction the
* last one.
*
* @param e action event
* @return {@link VirtualFile} file.
* @throws IllegalStateException in case if file not found in action event
*/
protected VirtualFile getEditorFile(ActionEvent e) {
Object o = e.getPresentation().getClientProperty(CURRENT_FILE_PROP);
if (o instanceof VirtualFile) {
return (VirtualFile) o;
}
throw new IllegalStateException("File doesn't provided");
}
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:EditorAbstractAction.java
示例2: updateInPerspective
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
@Override
public void updateInPerspective(@NotNull ActionEvent event) {
final Resource[] resources = appContext.getResources();
if (resources == null || resources.length == -1) {
event.getPresentation().setEnabledAndVisible(false);
return;
}
final Optional<Project> project = resources[0].getRelatedProject();
event
.getPresentation()
.setEnabledAndVisible(
project.isPresent() && project.get().isTypeOf(JSON_EXAMPLE_PROJECT_TYPE_ID));
}
开发者ID:eclipse,项目名称:che-archetypes,代码行数:18,代码来源:JsonExampleProjectAction.java
示例3: updateProjectAction
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
@Override
public void updateProjectAction(ActionEvent e) {
final Optional<Project> relatedProject = appContext.getResource().getRelatedProject();
if (!relatedProject.isPresent()) {
e.getPresentation().setEnabledAndVisible(false);
return;
}
Selection<?> selection = projectExplorer.getSelection();
if (selection == null) {
e.getPresentation().setEnabledAndVisible(false);
return;
}
e.getPresentation().setVisible(true);
e.getPresentation().setEnabled(true);
}
开发者ID:eclipse,项目名称:che-archetypes,代码行数:18,代码来源:NewXFileAction.java
示例4: actionPerformed
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
DocumentSymbolParams paramsDTO = dtoFactory.createDto(DocumentSymbolParams.class);
TextDocumentIdentifier identifierDTO = dtoFactory.createDto(TextDocumentIdentifier.class);
identifierDTO.setUri(
editorAgent.getActiveEditor().getEditorInput().getFile().getLocation().toString());
paramsDTO.setTextDocument(identifierDTO);
activeEditor = (TextEditor) editorAgent.getActiveEditor();
cursorPosition = activeEditor.getDocument().getCursorPosition();
client
.documentSymbol(paramsDTO)
.then(
arg -> {
cachedItems = arg;
presenter.run(GoToSymbolAction.this);
})
.catchError(
arg -> {
notificationManager.notify(
"Can't fetch document symbols.",
arg.getMessage(),
StatusNotification.Status.FAIL,
StatusNotification.DisplayMode.FLOAT_MODE);
});
}
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:GoToSymbolAction.java
示例5: runActions
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
/**
* Finds and runs an action cancelling original key event
*
* @param actionIds list containing action ids
* @param keyEvent original key event
*/
private void runActions(List<String> actionIds, Event keyEvent) {
for (String actionId : actionIds) {
Action action = actionManager.getAction(actionId);
if (action == null) {
continue;
}
ActionEvent e = new ActionEvent(presentationFactory.getPresentation(action), actionManager);
action.update(e);
if (e.getPresentation().isEnabled() && e.getPresentation().isVisible()) {
/** Stop handling the key event */
keyEvent.preventDefault();
keyEvent.stopPropagation();
/** Perform the action */
action.actionPerformed(e);
}
}
}
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:KeyBindingManager.java
示例6: actionPerformed
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
TextEditor textEditor = ((TextEditor) activeEditor);
TextDocumentPositionParams paramsDTO =
dtoBuildHelper.createTDPP(textEditor.getDocument(), textEditor.getCursorPosition());
final Promise<List<Location>> promise = client.definition(paramsDTO);
promise
.then(
arg -> {
if (arg.size() == 1) {
presenter.onLocationSelected(arg.get(0));
} else {
presenter.openLocation(promise);
}
})
.catchError(
arg -> {
presenter.showError(arg);
});
}
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:FindDefinitionAction.java
示例7: actionPerformed
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
ContributePartPresenter contributePartPresenter = contributePartPresenterProvider.get();
PartPresenter activePart = workspaceAgent.getActivePart();
if (activePart != null && activePart instanceof ContributePartPresenter) {
workspaceAgent.hidePart(contributePartPresenter);
EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
if (activeEditor != null) {
workspaceAgent.setActivePart(activeEditor);
}
return;
}
workspaceAgent.openPart(contributePartPresenter, TOOLING);
workspaceAgent.setActivePart(contributePartPresenter);
}
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:ContributePartDisplayingModeAction.java
示例8: actionPerformed
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
DebuggerPresenter debuggerPresenter = debuggerPresenterProvider.get();
PartPresenter activePart = workspaceAgent.getActivePart();
if (activePart != null && activePart instanceof DebuggerPresenter) {
workspaceAgent.hidePart(debuggerPresenter);
EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
if (activeEditor != null) {
workspaceAgent.setActivePart(activeEditor);
}
return;
}
workspaceAgent.openPart(debuggerPresenter, INFORMATION);
workspaceAgent.setActivePart(debuggerPresenter);
}
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:DebuggerDisplayingModeAction.java
示例9: updateInPerspective
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
@Override
public void updateInPerspective(ActionEvent event) {
ProcessTreeNode processTreeNode = processesPanelPresenter.getContextTreeNode();
if (processTreeNode == null) {
event.getPresentation().setEnabled(false);
event.getPresentation().setVisible(false);
return;
}
if (processesPanelPresenter.getContextOutputConsole() instanceof CommandOutputConsolePresenter
&& !processesPanelPresenter.getContextOutputConsole().isFinished()) {
event.getPresentation().setEnabled(true);
event.getPresentation().setVisible(true);
return;
}
event.getPresentation().setEnabled(false);
event.getPresentation().setVisible(false);
}
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:StopProcessAction.java
示例10: updateInPerspective
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
@Override
public void updateInPerspective(ActionEvent event) {
ProcessTreeNode processTreeNode = processesPanelPresenter.getContextTreeNode();
if (processTreeNode == null) {
event.getPresentation().setEnabled(false);
event.getPresentation().setVisible(false);
return;
}
if (ProcessTreeNode.ProcessNodeType.COMMAND_NODE == processTreeNode.getType()
|| ProcessTreeNode.ProcessNodeType.TERMINAL_NODE == processTreeNode.getType()) {
event.getPresentation().setEnabled(true);
event.getPresentation().setVisible(true);
return;
}
event.getPresentation().setEnabled(false);
event.getPresentation().setVisible(false);
}
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:CloseConsoleAction.java
示例11: updateInPerspective
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
@Override
public void updateInPerspective(ActionEvent e) {
if ((appContext.getRootProject() == null)) {
e.getPresentation().setVisible(true);
e.getPresentation().setEnabled(false);
return;
}
final Selection<?> selection = selectionAgent.getSelection();
if (selection == null || selection.isEmpty()) {
e.getPresentation().setEnabled(false);
return;
}
if (selection.isMultiSelection()) {
e.getPresentation().setEnabled(false);
return;
}
final Object possibleNode = selection.getHeadElement();
boolean enable = false;
if (possibleNode instanceof FileNode) {
FileNode fileNode = (FileNode) possibleNode;
File data = fileNode.getData();
String extension = data.getExtension();
if ("php".equals(extension) || "phtml".equals(extension)) {
enable = true;
selectedNodePath = data.getLocation().toString();
}
}
e.getPresentation().setEnabled(enable);
e.getPresentation().setVisible(enable);
}
开发者ID:eclipse,项目名称:che,代码行数:32,代码来源:PHPRunScriptTestAction.java
示例12: actionPerformed
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void actionPerformed(ActionEvent e) {
final Resource[] resources = appContext.getResources();
final Path searchPath;
if (resources == null || resources.length == 0 || resources.length > 1) {
searchPath = Path.ROOT;
} else {
if (resources[0] instanceof Container) {
searchPath = resources[0].getLocation();
} else {
final Container parent = resources[0].getParent();
searchPath = parent != null ? parent.getLocation() : Path.ROOT;
}
}
presenter.showDialog(searchPath);
}
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:FullTextSearchAction.java
示例13: actionPerformed
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
WorkspaceAgent workspaceAgent = workspaceAgentProvider.get();
ProcessesPanelPresenter processesPanelPresenter = processesPanelPresenterProvider.get();
if (isProcessesPanelActive() && isTerminalActive()) {
workspaceAgent.hidePart(processesPanelPresenter);
EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
if (activeEditor != null) {
workspaceAgent.setActivePart(activeEditor);
}
return;
}
processesPanelPresenter.provideTerminal();
}
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:TerminalDisplayingModeAction.java
示例14: updateInPerspective
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
@Override
public void updateInPerspective(@NotNull ActionEvent event) {
EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
if (activeEditor instanceof TextEditor) {
TextEditorConfiguration configuration = ((TextEditor) activeEditor).getConfiguration();
if (configuration instanceof LanguageServerEditorConfiguration) {
ServerCapabilities capabilities =
((LanguageServerEditorConfiguration) configuration).getServerCapabilities();
event
.getPresentation()
.setEnabledAndVisible(
capabilities.getDefinitionProvider() != null
&& capabilities.getDefinitionProvider());
return;
}
}
event.getPresentation().setEnabledAndVisible(false);
}
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:FindDefinitionAction.java
示例15: updateInPerspective
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
@Override
public void updateInPerspective(ActionEvent e) {
final Resource[] resources = appContext.getResources();
if (resources == null || resources.length != 1) {
e.getPresentation().setEnabledAndVisible(false);
return;
}
Resource resource = resources[0];
final boolean inJavaProject = isJavaProject(resource.getRelatedProject().get());
e.getPresentation()
.setEnabledAndVisible(
inJavaProject
&& resource.isFolder()
&& !resource.getMarker(SourceFolderMarker.ID).isPresent());
}
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:MarkDirAsSourceAction.java
示例16: promise
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
@Override
public Promise<Void> promise(final ActionEvent event) {
if (event.getParameters() == null
|| event.getParameters().get(SHOW_HIDDEN_FILES_PARAM_ID) == null) {
return Promises.reject(
JsPromiseError.create(
"Mandatory parameter" + SHOW_HIDDEN_FILES_PARAM_ID + " is not specified"));
}
final String showHiddenFilesKey = event.getParameters().get(SHOW_HIDDEN_FILES_PARAM_ID);
final boolean isShowHiddenFiles = Boolean.valueOf(showHiddenFilesKey);
final CallbackPromiseHelper.Call<Void, Throwable> call =
new CallbackPromiseHelper.Call<Void, Throwable>() {
@Override
public void makeCall(final Callback<Void, Throwable> callback) {
projectExplorerPresenter.showHiddenFiles(isShowHiddenFiles);
callback.onSuccess(null);
}
};
return createFromCallback(call);
}
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:ShowHiddenFilesAction.java
示例17: actionPerformed
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
String url =
appContext.getDevMachine().getWsAgentBaseUrl()
+ "/json-example/"
+ appContext.getWorkspaceId()
+ appContext.getRootProject().getLocation();
asyncRequestFactory
.createGetRequest(url, false)
.send(
new AsyncRequestCallback<Map<String, String>>(unmarshaller) {
@Override
protected void onSuccess(Map<String, String> linesPerFile) {
for (Map.Entry<String, String> entry : linesPerFile.entrySet()) {
String fileName = entry.getKey();
String loc = entry.getValue();
notificationManager.notify(
"File " + fileName + " has " + loc + " lines.",
StatusNotification.Status.SUCCESS,
StatusNotification.DisplayMode.FLOAT_MODE);
}
}
@Override
protected void onFailure(Throwable exception) {
notificationManager.notify(
exception.getMessage(),
StatusNotification.Status.FAIL,
StatusNotification.DisplayMode.FLOAT_MODE);
}
});
}
开发者ID:eclipse,项目名称:che-archetypes,代码行数:36,代码来源:CountLinesAction.java
示例18: actionPerformed
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
this.notificationManager.notify(
"Hello World",
StatusNotification.Status.SUCCESS,
StatusNotification.DisplayMode.FLOAT_MODE);
}
开发者ID:eclipse,项目名称:che-archetypes,代码行数:8,代码来源:HelloWorldAction.java
示例19: actionPerformed
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent actionEvent) {
notificationManager.notify(
"Hello form Che!!!",
StatusNotification.Status.SUCCESS,
StatusNotification.DisplayMode.FLOAT_MODE);
}
开发者ID:eclipse,项目名称:che-archetypes,代码行数:8,代码来源:SampleAction.java
示例20: actionPerformed
import org.eclipse.che.ide.api.action.ActionEvent; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
// This calls the service in the workspace.
// This method is in our org.eclipse.che.plugin.serverservice.ide.MyServiceClient class
// This is a Promise, so the .then() method is invoked after the response is made
serviceClient
.getHello("CheTheAllPowerful!")
.then(
new Operation<String>() {
@Override
public void apply(String response) throws OperationException {
// This passes the response String to the notification manager.
notificationManager.notify(
response,
StatusNotification.Status.SUCCESS,
StatusNotification.DisplayMode.FLOAT_MODE);
}
})
.catchError(
new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
notificationManager.notify(
"Fail",
StatusNotification.Status.FAIL,
StatusNotification.DisplayMode.FLOAT_MODE);
}
});
}
开发者ID:eclipse,项目名称:che-archetypes,代码行数:30,代码来源:MyAction.java
注:本文中的org.eclipse.che.ide.api.action.ActionEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论