本文整理汇总了Java中org.eclipse.jdt.ui.actions.OpenAction类的典型用法代码示例。如果您正苦于以下问题:Java OpenAction类的具体用法?Java OpenAction怎么用?Java OpenAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OpenAction类属于org.eclipse.jdt.ui.actions包,在下文中一共展示了OpenAction类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createActions
import org.eclipse.jdt.ui.actions.OpenAction; //导入依赖的package包/类
private void createActions() {
// For the following commands we use actions, as they are already available
final IActionBars ab = getViewSite().getActionBars();
openAction = new OpenAction(getSite());
openAction
.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR);
ab.setGlobalActionHandler(JdtActionConstants.OPEN, openAction);
openAction.setEnabled(false);
viewer.addSelectionChangedListener(openAction);
PropertyDialogAction propertiesAction = new PropertyDialogAction(getSite(),
viewer);
propertiesAction
.setActionDefinitionId(IWorkbenchCommandConstants.FILE_PROPERTIES);
ab.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(),
propertiesAction);
propertiesAction.setEnabled(false);
viewer.addSelectionChangedListener(propertiesAction);
}
示例2: run
import org.eclipse.jdt.ui.actions.OpenAction; //导入依赖的package包/类
@Override
public void run() {
IJavaElement inputElement= fInfoView.getOrignalInput();
new OpenAction(fInfoView.getViewSite()).run(new Object[] { inputElement });
}
示例3: createActions
import org.eclipse.jdt.ui.actions.OpenAction; //导入依赖的package包/类
@Override
protected void createActions() {
super.createActions();
fSelectAllAction= new SelectAllAction(fViewer);
// Setup OpenAction
fOpen= new OpenAction(getViewSite()) {
/*
* @see org.eclipse.jdt.ui.actions.SelectionDispatchAction#getSelection()
*/
@Override
public ISelection getSelection() {
return convertToJavaElementSelection(fViewer.getSelection());
}
/*
* @see org.eclipse.jdt.ui.actions.OpenAction#run(IStructuredSelection)
*/
@Override
public void run(IStructuredSelection selection) {
if (selection.isEmpty()) {
getShell().getDisplay().beep();
return;
}
super.run(selection);
}
/*
* @see org.eclipse.jdt.ui.actions.OpenAction#getElementToOpen(Object)
*/
@Override
public Object getElementToOpen(Object object) throws JavaModelException {
if (object instanceof IJavaElement)
fLastOpenedElement= (IJavaElement)object;
else
fLastOpenedElement= null;
return super.getElementToOpen(object);
}
/*
* @see org.eclipse.jdt.ui.actions.OpenAction#run(Object[])
*/
@Override
public void run(Object[] elements) {
stopListeningForSelectionChanges();
super.run(elements);
startListeningForSelectionChanges();
}
};
}
示例4: OpenAndExpand
import org.eclipse.jdt.ui.actions.OpenAction; //导入依赖的package包/类
public OpenAndExpand(IWorkbenchSite site, OpenAction openAction, TreeViewer viewer) {
super(site);
fOpenAction = openAction;
fViewer = viewer;
}
示例5: run
import org.eclipse.jdt.ui.actions.OpenAction; //导入依赖的package包/类
@Override
public void run() {
IJavaElement inputElement= fInfoView.getInput();
new OpenAction(fInfoView.getViewSite()).run(new Object[] { inputElement });
}