本文整理匯總了Java中org.eclipse.jface.viewers.TreeSelection.getPaths方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeSelection.getPaths方法的具體用法?Java TreeSelection.getPaths怎麽用?Java TreeSelection.getPaths使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jface.viewers.TreeSelection
的用法示例。
在下文中一共展示了TreeSelection.getPaths方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doubleClick
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
@Override
public void doubleClick(final DoubleClickEvent event) {
// safety check first
if (event == null || event.getSelection() == null || !(event.getSelection() instanceof TreeSelection)) {
return;
}
final TreeSelection selection = (TreeSelection) event.getSelection();
final TreePath[] paths = selection.getPaths();
final TreePath treePath = paths[paths.length - 1];
final Object segment = treePath.getLastSegment();
final TreeItem[] items = viewer.getTree().getItems();
final TreeItem item = getItem(items, segment);
if (item != null) {
item.setExpanded(!item.getExpanded());
viewer.refresh();
}
}
示例2: run
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
@Override
public void run() {
TreeSelection s = (TreeSelection) treeViewer.getSelection();
TreePath[] p = s.getPaths();
for (int i = 0; i < p.length;) {
final Object obj = p[i].getLastSegment();
if (obj instanceof ANode) {
ANode parent = (ANode) obj;
AddResourceWizard wizard = new AddResourceWizard(parent);
WizardDialog dialog = new WizardDialog(UIUtils.getShell(), wizard);
dialog.create();
dialog.open();
}
break;
}
}
示例3: run
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
@Override
public void run() {
final TreeSelection s = (TreeSelection) treeViewer.getSelection();
TreePath[] p = s.getPaths();
for (int i = 0; i < p.length; i++) {
final Object obj = p[i].getLastSegment();
if (obj instanceof MResource) {
PermissionWizard wizard = new PermissionWizard((MResource) obj);
PermissionDialog dialog = new PermissionDialog(UIUtils.getShell(), wizard);
dialog.addApplyListener(wizard);
dialog.open();
} else if (obj instanceof MServerProfile) {
EditServerAction.fillServerProfile((MServerProfile) obj, treeViewer);
}
}
}
示例4: run
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
@Override
public void run() {
final TreeSelection s = (TreeSelection) treeViewer.getSelection();
TreePath[] p = s.getPaths();
for (int i = 0; i < p.length; i++) {
Object obj = p[i].getLastSegment();
if (obj instanceof MResource) {
INode node = ((MResource) obj).getReportUnit();
if (node != null) {
final String key = ServerManager.getKey((MReportUnit) node);
if (key != null)
Display.getDefault().asyncExec(new Runnable() {
public void run() {
SelectionHelper.openEditor(key, ReportUnitEditor.ID);
}
});
}
break;
}
}
}
示例5: run
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
@Override
public void run() {
TreeSelection s = (TreeSelection) treeViewer.getSelection();
TreePath[] p = s.getPaths();
List<MResource> rlist = new ArrayList<MResource>();
for (int i = 0; i < p.length; i++) {
final Object obj = p[i].getLastSegment();
if (obj instanceof MResource) {
System.out.println(((MResource) obj).getToolTip());
((MResource) obj).setCut(true);
rlist.add((MResource) obj);
}
}
if (!rlist.isEmpty())
Clipboard.getDefault().setContents(rlist);
}
示例6: run
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
@Override
public void run() {
TreeSelection s = (TreeSelection) treeViewer.getSelection();
TreePath[] p = s.getPaths();
for (int i = 0; i < p.length; i++) {
Object obj = p[i].getLastSegment();
if (obj instanceof MDataAdapter) {
SaveAsDialog saveAsDialog = new SaveAsDialog(Display.getDefault().getActiveShell());
saveAsDialog.setOriginalName(((MDataAdapter) obj).getValue().getName().replace(" ", "") + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
saveAsDialog.open();
IPath path = saveAsDialog.getResult();
if (path != null)
saveFile(obj, path);
}
}
}
示例7: run
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
@Override
public void run() {
TreeSelection s = (TreeSelection) treeViewer.getSelection();
TreePath[] p = s.getPaths();
if (!UIUtils.showDeleteConfirmation())
return;
ADataAdapterStorage storage = null;
for (int i = 0; i < p.length; i++) {
Object obj = p[i].getLastSegment();
if (obj instanceof MDataAdapter) {
MDataAdapter mDataAdapter = (MDataAdapter) obj;
DataAdapterDescriptor m = mDataAdapter.getValue();
if (storage == null)
storage = ((MDataAdapters) mDataAdapter.getParent()).getValue();
if (storage != null)
storage.removeDataAdapter(m);
treeViewer.refresh(true);
}
}
}
示例8: openTwin
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
/** Expands the element with the same name in the given treeviewer.
* @param selection TreeSelection
* @param tv
*/
private void openTwin(TreeSelection selection,
TreeViewer tv) {
TreePath[] path = selection.getPaths();
BTSObjectTypeTreeNode nodeRight = (BTSObjectTypeTreeNode) tv.getInput();
TreePath tp = path[0];
List<BTSObjectTypeTreeNode> elements = new Vector<BTSObjectTypeTreeNode>(tp.getSegmentCount());
for (int i = 0 ; i < tp.getSegmentCount(); i++)
{
BTSObjectTypeTreeNode leftNode = (BTSObjectTypeTreeNode) tp.getSegment(i);
BTSObjectTypeTreeNode childRight = null;
if (nodeRight != null)
{
for (BTSObjectTypeTreeNode c : nodeRight.getChildren())
{
if (c.getValue() != null && c.getValue().equals(leftNode.getValue()))
{
childRight = c;
elements.add(childRight);
break;
}
}
nodeRight = childRight;
}
}
tv.setExpandedElements(elements.toArray(new BTSObjectTypeTreeNode[elements.size()]));
}
示例9: close
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
@Override
public boolean close() {
if (root != null && root.getRoot() != null)
root.getRoot().getPropertyChangeSupport()
.removePropertyChangeListener(metaDataListener);
if (getReturnCode() == OK) {
TreeSelection ts = (TreeSelection) treeViewer.getSelection();
for (TreePath tp : ts.getPaths())
if (tp.getSegmentCount() == 2)
cols.put((MSQLColumn) tp.getLastSegment(),
(MFromTable) tp.getFirstSegment());
}
return super.close();
}
示例10: run
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
@Override
public void run() {
final TreeSelection s = (TreeSelection) treeViewer.getSelection();
TreePath[] p = s.getPaths();
for (int i = 0; i < p.length; i++) {
final Object obj = p[i].getLastSegment();
if (obj instanceof MResource) {
try {
mres = (MResource) obj;
if (!(mres instanceof MFolder)) {
NullProgressMonitor monitor = new NullProgressMonitor();
ResourceDescriptor rd = WSClientHelper.getResource(monitor, mres, mres.getValue());
ANode parent = mres.getParent();
int index = parent.getChildren().indexOf(mres);
parent.removeChild(mres);
mres = ResourceFactory.getResource(parent, rd, index);
if (mres instanceof IInputControlsContainer)
WSClientHelper.refreshContainer(mres, monitor);
// if(ModelUtil.isEmpty(mres))
WSClientHelper.fireResourceChanged(mres);
}
ResourceWizard wizard = new ResourceWizard(mres, mres);
WizardDialog dialog = new WizardDialog(UIUtils.getShell(), wizard);
dialog.create();
dialog.open();
} catch (Exception e) {
UIUtils.showError(e);
}
break;
}
}
}
示例11: isDataResource
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
private boolean isDataResource() {
final TreeSelection s = (TreeSelection) treeViewer.getSelection();
TreePath[] p = s.getPaths();
for (int i = 0; i < p.length; i++) {
if (!isFileResource(p[i].getLastSegment()))
return false;
}
return true;
}
示例12: run
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
@Override
public void run() {
final TreeSelection s = (TreeSelection) treeViewer.getSelection();
TreePath[] p = s.getPaths();
for (int i = 0; i < p.length; i++) {
final Object obj = p[i].getLastSegment();
if (isFileResource(obj)) {
if (preDownload((AFileResource) obj)) {
WorkspaceJob job = new WorkspaceJob("Open File In Editor") {
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
try {
monitor.beginTask("Open File In Editor", IProgressMonitor.UNKNOWN);
dorun(obj, monitor);
} catch (Throwable e) {
UIUtils.showError(e);
} finally {
monitor.done();
}
return Status.OK_STATUS;
}
};
job.setUser(true);
job.schedule();
}
break;
}
}
}
示例13: run
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
@Override
public void run() {
TreeSelection s = (TreeSelection) treeViewer.getSelection();
TreePath[] p = s.getPaths();
List<MResource> rlist = new ArrayList<MResource>();
for (int i = 0; i < p.length; i++) {
final Object obj = p[i].getLastSegment();
if (obj instanceof MResource) {
rlist.add((MResource) obj);
}
}
if (!rlist.isEmpty())
Clipboard.getDefault().setContents(rlist);
}
示例14: isRunnable
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
private boolean isRunnable() {
final TreeSelection s = (TreeSelection) treeViewer.getSelection();
TreePath[] p = s.getPaths();
for (int i = 0; i < p.length; i++) {
if (!isInReportUnit(p[i].getLastSegment()))
return false;
}
return true;
}
示例15: getSelected
import org.eclipse.jface.viewers.TreeSelection; //導入方法依賴的package包/類
protected ANode getSelected() {
s = (TreeSelection) treeViewer.getSelection();
TreePath[] p = s.getPaths();
for (int i = 0; i < p.length; i++) {
Object obj = p[i].getLastSegment();
if (obj instanceof MResource || obj instanceof MServerProfile)
return (ANode) obj;
}
return null;
}