Java Code Examples for org.eclipse.nebula.widgets.grid.GridItem#getData()

The following examples show how to use org.eclipse.nebula.widgets.grid.GridItem#getData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MatchViewerBodyMenu.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
public void updateEnabledState() {

			int selectionIndex = view.gridTable.getSelectionIndex();
			if (selectionIndex < 0 || selectionIndex > view.gridTable.getItemCount()) {
				setEnabled(false);
				return;
			}
			GridItem item = view.gridTable.getItem(selectionIndex);
			Object obj = item.getData("tmFuzzyInfo");
			if (obj == null) {
				setEnabled(false);
				return;
			}
			FuzzySearchResult fuzzyResult = (FuzzySearchResult) obj;
			if (fuzzyResult.getDbOp() == null) {
				setEnabled(false);
				return;
			}
			setEnabled(true);

		}
 
Example 2
Source File: MatchViewerBodyMenu.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void run() {
	if (!MessageDialog.openConfirm(view.getSite().getShell(),
			Messages.getString("view.MatchViewerBodyMenu.confirm.title"),
			Messages.getString("view.MatchViewerBodyMenu.confirm.deleteInfo"))) {
		return;
	}
	int selectionIndex = view.gridTable.getSelectionIndex();
	if (selectionIndex < 0 || selectionIndex > view.gridTable.getItemCount()) {
		return;
	}
	GridItem item = view.gridTable.getItem(selectionIndex);
	Object obj = item.getData("tmFuzzyInfo");
	if (obj == null) {
		return;
	}
	FuzzySearchResult fuzzyResult = (FuzzySearchResult) obj;
	try {
		view.tmMatcher.deleteFuzzyResult(fuzzyResult);
		view.reLoadMatches(editor, rowIndex);
	} catch (Exception e) {
		MessageDialog.openError(view.getSite().getShell(),
				Messages.getString("view.MatchViewerBodyMenu.erorr.title"),
				Messages.getString("view.MatchViewerBodyMenu.error.deleteError") + e.getMessage());
	}
}
 
Example 3
Source File: MatchViewerBodyMenu.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
public void updateEnabledState() {
	int selectionIndex = view.gridTable.getSelectionIndex();
	if (selectionIndex < 0 || selectionIndex > view.gridTable.getItemCount()) {
		setEnabled(false);
		return;
	}
	GridItem item = view.gridTable.getItem(selectionIndex);
	Object obj = item.getData("tmFuzzyInfo");
	if (obj == null) {
		setEnabled(false);
		return;
	}
	FuzzySearchResult fuzzyResult = (FuzzySearchResult) obj;
	if (fuzzyResult.getDbOp() == null) {
		setEnabled(false);
		return;
	}
	setEnabled(true);
}
 
Example 4
Source File: MatchViewerBodyMenu.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void run() {
	int selectionIndex = view.gridTable.getSelectionIndex();
	if (selectionIndex < 0 || selectionIndex > view.gridTable.getItemCount()) {
		return;
	}
	GridItem item = view.gridTable.getItem(selectionIndex);
	Object obj = item.getData("tmFuzzyInfo");
	if (obj == null) {
		return;
	}
	FuzzySearchResult fuzzyResult = (FuzzySearchResult) obj;

	TmMatchEditDialog dlg = new TmMatchEditDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), fuzzyResult);
	if (dlg.open() == Window.OK) {
		try {
			view.tmMatcher.updateFuzzResult(fuzzyResult);
			view.reLoadMatches(view.editor, view.rowIndex);
		} catch (Exception e) {
			MessageDialog.openError(view.getSite().getShell(),
					Messages.getString("view.MatchViewerBodyMenu.erorr.title"),
					Messages.getString("view.MatchViewerBodyMenu.error.editError") + e.getMessage());
			logger.error("Updaste TM matche Error",e);
		}
	}
}
 
Example 5
Source File: MatchViewerBodyMenu.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
public void updateEnabledState() {

			int selectionIndex = view.gridTable.getSelectionIndex();
			if (selectionIndex < 0 || selectionIndex > view.gridTable.getItemCount()) {
				setEnabled(false);
				return;
			}
			GridItem item = view.gridTable.getItem(selectionIndex);
			Object obj = item.getData("tmFuzzyInfo");
			if (obj == null) {
				setEnabled(false);
				return;
			}
			FuzzySearchResult fuzzyResult = (FuzzySearchResult) obj;
			if (fuzzyResult.getDbOp() == null) {
				setEnabled(false);
				return;
			}
			setEnabled(true);

		}
 
Example 6
Source File: MatchViewerBodyMenu.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void run() {
	if (!MessageDialog.openConfirm(view.getSite().getShell(),
			Messages.getString("view.MatchViewerBodyMenu.confirm.title"),
			Messages.getString("view.MatchViewerBodyMenu.confirm.deleteInfo"))) {
		return;
	}
	int selectionIndex = view.gridTable.getSelectionIndex();
	if (selectionIndex < 0 || selectionIndex > view.gridTable.getItemCount()) {
		return;
	}
	GridItem item = view.gridTable.getItem(selectionIndex);
	Object obj = item.getData("tmFuzzyInfo");
	if (obj == null) {
		return;
	}
	FuzzySearchResult fuzzyResult = (FuzzySearchResult) obj;
	try {
		view.tmMatcher.deleteFuzzyResult(fuzzyResult);
		view.reLoadMatches(view.editor, view.rowIndex);
	} catch (Exception e) {
		MessageDialog.openError(view.getSite().getShell(),
				Messages.getString("view.MatchViewerBodyMenu.erorr.title"),
				Messages.getString("view.MatchViewerBodyMenu.error.deleteError") + e.getMessage());
	}
}
 
Example 7
Source File: MatchViewerBodyMenu.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
public void updateEnabledState() {
	int selectionIndex = view.gridTable.getSelectionIndex();
	if (selectionIndex < 0 || selectionIndex > view.gridTable.getItemCount()) {
		setEnabled(false);
		return;
	}
	GridItem item = view.gridTable.getItem(selectionIndex);
	Object obj = item.getData("tmFuzzyInfo");
	if (obj == null) {
		setEnabled(false);
		return;
	}
	FuzzySearchResult fuzzyResult = (FuzzySearchResult) obj;
	if (fuzzyResult.getDbOp() == null) {
		setEnabled(false);
		return;
	}
	setEnabled(true);
}
 
Example 8
Source File: GridViewerRow.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private ViewerRow getRowBelow() {
	int index = item.getRowIndex() + 1;

	if (index < item.getParent().getItemCount()) {
		GridItem tmp = item.getParent().getItem(index);
		// Maybe this is a dummy item!!

		if (tmp != null && !tmp.isDisposed() && tmp.isVisible() && tmp.getData() != null) {
			return new GridViewerRow(tmp);
		}
	}

	return null;
}
 
Example 9
Source File: MatchViewerBodyMenu.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void run() {
	int selectionIndex = view.gridTable.getSelectionIndex();
	if (selectionIndex < 0 || selectionIndex > view.gridTable.getItemCount()) {
		return;
	}
	GridItem item = view.gridTable.getItem(selectionIndex);
	Object obj = item.getData("tmFuzzyInfo");
	if (obj == null) {
		return;
	}
	FuzzySearchResult fuzzyResult = (FuzzySearchResult) obj;

	TmMatchEditDialog dlg = new TmMatchEditDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
			fuzzyResult);
	if (dlg.open() == Window.OK) {
		try {
			view.tmMatcher.updateFuzzResult(fuzzyResult);
			view.reLoadMatches(editor, rowIndex);
		} catch (Exception e) {
			MessageDialog.openError(view.getSite().getShell(),
					Messages.getString("view.MatchViewerBodyMenu.erorr.title"),
					Messages.getString("view.MatchViewerBodyMenu.error.editError") + e.getMessage());
			logger.error("Updaste TM matche Error", e);
		}
	}
}
 
Example 10
Source File: MatchViewerBodyMenu.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void run() {

	if (editor == null || rowIndex < 0) {
		return;
	}
	TransUnitBean transUnit = editor.getRowTransUnitBean(rowIndex);
	Hashtable<String, String> tuProp = transUnit.getTuProps();
	if (tuProp != null) {
		String translate = tuProp.get("translate");
		if (translate != null && translate.equalsIgnoreCase("no")) {
			MessageDialog.openInformation(view.getSite().getShell(),
					Messages.getString("view.MatchViewPart.msgTitle"),
					Messages.getString("view.MatchViewPart.msg2"));
			return;
		}
	}

	int selectionIndex = view.gridTable.getSelectionIndex();
	if (selectionIndex < 0 || selectionIndex > view.gridTable.getItemCount()) {
		return;
	}
	GridItem item = view.gridTable.getItem(selectionIndex);
	String pureText = (String) item.getData("tgtText");
	String matchType = item.getData("matchType").toString();
	String quality = item.getData("quality").toString();
	try {
		if (!matchType.equals("TM")) {
			matchType = null;
			quality = null;
		}
		editor.updateCell(rowIndex, editor.getTgtColumnIndex(), pureText, matchType, quality);
		// editor.setFocus(); // 焦点给回编辑器
	} catch (ExecutionException e) {
		MatchViewPart.LOGGER.error("", e);
		MessageDialog.openInformation(view.getSite().getShell(),
				Messages.getString("view.MatchViewPart.msgTitle"),
				Messages.getString("view.MatchViewPart.msg3") + e.getMessage());
	}

}
 
Example 11
Source File: MatchViewerBodyMenu.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void run() {

	if (view.editor == null || view.rowIndex < 0) {
		return;
	}
	TransUnitBean transUnit = view.editor.getRowTransUnitBean(view.rowIndex);
	Hashtable<String, String> tuProp = transUnit.getTuProps();
	if (tuProp != null) {
		String translate = tuProp.get("translate");
		if (translate != null && translate.equalsIgnoreCase("no")) {
			MessageDialog.openInformation(view.getSite().getShell(),
					Messages.getString("view.MatchViewPart.msgTitle"),
					Messages.getString("view.MatchViewPart.msg2"));
			return;
		}
	}

	int selectionIndex = view.gridTable.getSelectionIndex();
	if (selectionIndex < 0 || selectionIndex > view.gridTable.getItemCount()) {
		return;
	}
	GridItem item = view.gridTable.getItem(selectionIndex);
	String pureText = (String) item.getData("tgtText");
	String matchType = item.getData("matchType").toString();
	String quality = item.getData("quality").toString();
	try {
		if (!matchType.equals("TM")) {
			matchType = null;
			quality = null;
		}
		view.editor.updateCell(view.rowIndex, view.editor.getTgtColumnIndex(), pureText, matchType, quality);
		// editor.setFocus(); // 焦点给回编辑器
	} catch (ExecutionException e) {
		MatchViewPart.LOGGER.error("", e);
		MessageDialog.openInformation(view.getSite().getShell(),
				Messages.getString("view.MatchViewPart.msgTitle"),
				Messages.getString("view.MatchViewPart.msg3") + e.getMessage());
	}

}