當前位置: 首頁>>代碼示例>>Java>>正文


Java TreeSelection.getPaths方法代碼示例

本文整理匯總了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();
	}
}
 
開發者ID:FI13,項目名稱:afbb-bibo,代碼行數:19,代碼來源:TreeCollapseExpandListener.java

示例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;
	}

}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:18,代碼來源:AddResourceAction.java

示例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);
		}
	}
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:17,代碼來源:ShowPermissionsAction.java

示例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;
		}
	}
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:23,代碼來源:RunReportUnitAction.java

示例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);
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:17,代碼來源:CutResourceAction.java

示例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);
		}
	}
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:18,代碼來源:ExportDataAdapterAction.java

示例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);
		}
	}
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:22,代碼來源:DeleteDataAdapterAction.java

示例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()]));

}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:32,代碼來源:RelationSubjectObjectTypesSelectionComposite.java

示例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();
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:15,代碼來源:FromTableColumnsDialog.java

示例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;
		}
	}
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:33,代碼來源:PropertiesAction.java

示例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;
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:10,代碼來源:OpenInEditorAction.java

示例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;
		}
	}
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:29,代碼來源:OpenInEditorAction.java

示例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);
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:15,代碼來源:CopyResourceAction.java

示例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;
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:10,代碼來源:RunReportUnitAction.java

示例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;
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:11,代碼來源:PasteResourceAction.java


注:本文中的org.eclipse.jface.viewers.TreeSelection.getPaths方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。