use of org.eclipse.swt.widgets.ToolBar in project translationstudio8 by heartsome.
the class JavaPropertiesViewerDialog method createToolBar.
private void createToolBar(Composite tparent) {
Composite toolBarCmp = new Composite(tparent, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(toolBarCmp);
GridLayoutFactory.fillDefaults().numColumns(1).applyTo(toolBarCmp);
ToolBar toolBar = new ToolBar(toolBarCmp, SWT.NO_FOCUS | SWT.FLAT);
ToolItem openItem = new ToolItem(toolBar, SWT.PUSH);
openItem.setToolTipText(Messages.getString("dialog.JavaPropertiesViewerDialog.toolBar"));
openItem.setImage(new Image(Display.getDefault(), openFilePath));
openItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
openFile();
}
});
}
use of org.eclipse.swt.widgets.ToolBar in project translationstudio8 by heartsome.
the class CSV2TMXConverterDialog method createToolBar.
/**
* 创建工具栏
* @param parent
* ;
*/
private void createToolBar(Composite parent) {
Composite cmpToolBar = new Composite(parent, SWT.None);
GridLayoutFactory.fillDefaults().spacing(0, 0).numColumns(3).equalWidth(false).applyTo(cmpToolBar);
cmpToolBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
ToolBar toolBar = new ToolBar(cmpToolBar, SWT.NO_FOCUS | SWT.FLAT);
ToolItem openToolItem = new ToolItem(toolBar, SWT.PUSH);
openToolItem.setToolTipText(Messages.getString("dialog.CSV2TMXConverterDialog.openToolItem"));
String openCSVPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_OPEN_CSV_PATH);
openToolItem.setImage(new Image(Display.getDefault(), openCSVPath));
openToolItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
openFile();
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
ToolItem exporToolItem = new ToolItem(toolBar, SWT.PUSH);
exporToolItem.setToolTipText(Messages.getString("dialog.CSV2TMXConverterDialog.exporToolItem"));
String exportPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_EXPORT_TBX_PATH);
exporToolItem.setImage(new Image(Display.getDefault(), exportPath));
exporToolItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
export();
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
ToolItem deleteColToolItem = new ToolItem(toolBar, SWT.PUSH);
deleteColToolItem.setToolTipText(Messages.getString("dialog.CSV2TMXConverterDialog.deleteColToolItem"));
String deleteColPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_DELETE_COLUMN_PATH);
deleteColToolItem.setImage(new Image(Display.getDefault(), deleteColPath));
deleteColToolItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
removeColumn();
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
ToolItem setColToolItem = new ToolItem(toolBar, SWT.PUSH);
setColToolItem.setToolTipText(Messages.getString("dialog.CSV2TMXConverterDialog.setColToolItem"));
String setColPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_SET_COLUMN_PATH);
setColToolItem.setImage(new Image(Display.getDefault(), setColPath));
setColToolItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
selectLanguage();
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
new Label(cmpToolBar, SWT.None).setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
ToolBar helpToolBar = new ToolBar(cmpToolBar, SWT.NO_FOCUS | SWT.FLAT);
ToolItem helpToolItem = new ToolItem(helpToolBar, SWT.RIGHT);
helpToolItem.setToolTipText(Messages.getString("dialog.CSV2TMXConverterDialog.helpToolBar"));
String helpPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_HELP_PATH);
helpToolItem.setImage(new Image(Display.getDefault(), helpPath));
helpToolItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
displayHelp();
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
}
use of org.eclipse.swt.widgets.ToolBar in project translationstudio8 by heartsome.
the class ImportProjectHandler method execute.
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
ImportProjectWizard wizard = new ImportProjectWizard();
TSWizardDialog dialog = new TSWizardDialog(window.getShell(), wizard) {
/**
* 添加帮助按钮
* robert 2012-09-06
*/
@Override
protected Control createHelpControl(Composite parent) {
// ROBERTHELP 导入项目
String language = CommonFunction.getSystemLanguage();
final String helpUrl = MessageFormat.format("/net.heartsome.cat.ts.ui.help/html/{0}/ch07s03.html#import-project", language);
Image helpImage = JFaceResources.getImage(DLG_IMG_HELP);
ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS);
((GridLayout) parent.getLayout()).numColumns++;
toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
toolBar.setCursor(cursor);
toolBar.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
cursor.dispose();
}
});
ToolItem helpItem = new ToolItem(toolBar, SWT.NONE);
helpItem.setImage(helpImage);
//$NON-NLS-1$
helpItem.setToolTipText(JFaceResources.getString("helpToolTip"));
helpItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl);
}
});
return toolBar;
}
};
dialog.setHelpAvailable(true);
dialog.open();
return null;
}
use of org.eclipse.swt.widgets.ToolBar in project translationstudio8 by heartsome.
the class PreMachineTranslationDialog method createHelpControl.
// TODO :帮助按钮URL需要修改
/**
* 添加帮助按钮 robert 2012-09-06
*/
@Override
protected Control createHelpControl(Composite parent) {
// ROBERTHELP 预翻译
String language = CommonFunction.getSystemLanguage();
final String helpUrl = MessageFormat.format("/net.heartsome.cat.ts.ui.help/html/{0}/ch05s03.html?#prestore-mt", language);
Image helpImage = JFaceResources.getImage(DLG_IMG_HELP);
ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS);
((GridLayout) parent.getLayout()).numColumns++;
toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
toolBar.setCursor(cursor);
toolBar.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
cursor.dispose();
}
});
ToolItem helpItem = new ToolItem(toolBar, SWT.NONE);
helpItem.setImage(helpImage);
//$NON-NLS-1$
helpItem.setToolTipText(JFaceResources.getString("helpToolTip"));
helpItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl);
}
});
return toolBar;
}
use of org.eclipse.swt.widgets.ToolBar in project cogtool by cogtool.
the class WebCrawlImportDialog method makeToolBarButton.
public ToolBar makeToolBarButton(Composite comp, SelectionListener listener, questionImages question) {
ToolBar toolBar = new ToolBar(comp, SWT.FLAT);
ToolItem item = new ToolItem(toolBar, SWT.NONE);
Image image = null;
if (question == questionImages.PLUS_IMAGE) {
image = OSUtils.MACOSX ? imagePlusMac : imagePlus;
} else if (question == questionImages.MINUS_IMAGE) {
image = OSUtils.MACOSX ? imageMinusMac : imageMinus;
} else if (question == questionImages.QUESTION_IMAGE) {
image = OSUtils.MACOSX ? questionImageMac : questionImage;
} else if (question == questionImages.QUESTION_SHADOW) {
image = OSUtils.MACOSX ? questionImageMacShadow : questionImage;
}
item.setImage(image);
item.addSelectionListener(listener);
return toolBar;
}
Aggregations