本文整理汇总了Java中org.eclipse.swt.program.Program类的典型用法代码示例。如果您正苦于以下问题:Java Program类的具体用法?Java Program怎么用?Java Program使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Program类属于org.eclipse.swt.program包,在下文中一共展示了Program类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadImage
import org.eclipse.swt.program.Program; //导入依赖的package包/类
public Image loadImage(File file) {
if (OSExplorer.getInstance().isRoot(file)) {
return loadImage("drive.png");
} else if (file.isDirectory()) {
return loadImage("folder.png");
} else {
String extension = OSExplorer.getInstance().getExtension(file);
if (extension.equals("")) {
return loadImage("file.png");
} else {
Program program = Program.findProgram(extension);
if (program == null) {
return loadImage("file.png");
} else {
return loadImage(program);
}
}
}
}
示例2: createViewerToolTipContentArea
import org.eclipse.swt.program.Program; //导入依赖的package包/类
@Override
protected Composite createViewerToolTipContentArea(Event event, ViewerCell cell, Composite parent) {
final Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(2, false));
composite.setBackground(rowColorBack);
Plugin plugin = (Plugin) cell.getElement();
Hyperlink button = new Hyperlink(composite, SWT.FLAT);
button.setText("\uf05A");
button.setFont(fontAwesome);
button.setBackground(composite.getBackground());
button.setForeground(rowColorTitle);
button.setUnderlined(false);
button.addListener (SWT.MouseDown, e -> Program.launch(GLUON_PLUGIN_URL + plugin.getUrl()));
button.setToolTipText("Click to access the service's JavaDoc");
Label text = new Label(composite, SWT.LEFT);
final String description = plugin.getDescription();
text.setText(description.contains(".") ? description.substring(0, description.indexOf(".")) : description);
text.setBackground(composite.getBackground());
text.setForeground(rowColorTitle);
composite.pack();
return composite;
}
示例3: LinkComposite
import org.eclipse.swt.program.Program; //导入依赖的package包/类
public LinkComposite ( final Composite parent, final int style, final String format )
{
super ( parent, style );
final RowLayout layout = new RowLayout ();
layout.wrap = false;
layout.center = true;
layout.spacing = 7;
layout.pack = true;
setLayout ( layout );
this.textLabel = new Link ( this, SWT.NONE );
this.textLabel.setText ( format );
this.textLabel.addSelectionListener ( new SelectionAdapter () {
@Override
public void widgetSelected ( final SelectionEvent event )
{
logger.info ( "LinkComponent selected: {}", event.text ); //$NON-NLS-1$
Program.launch ( event.text );
}
} );
}
示例4: launchURL
import org.eclipse.swt.program.Program; //导入依赖的package包/类
private static void launchURL(String s) {
Program program = Program.findProgram(".html");
if (program != null && program.getName().contains("Chrome")) {
try {
Field field = Program.class.getDeclaredField("command");
field.setAccessible(true);
String command = (String) field.get(program);
command = command.replaceAll("%[1lL]", s);
command = command.replace(" --", "");
PluginInitializer.getDefaultInterface().getUtilities().createProcess(command + " -incognito");
} catch (Exception e1) {
e1.printStackTrace();
Utils.launch(s);
}
} else {
Utils.launch(s);
}
}
示例5: isProgramInstalled
import org.eclipse.swt.program.Program; //导入依赖的package包/类
@Override
public boolean
isProgramInstalled(
String extension,
String name )
{
if ( !extension.startsWith( "." )){
extension = "." + extension;
}
Program program = Program.findProgram( extension );
return( program == null ? false:(program.getName().toLowerCase(Locale.US)
.contains(name.toLowerCase(Locale.US))));
}
示例6: createCompleteMessageDialog
import org.eclipse.swt.program.Program; //导入依赖的package包/类
/**
*
* void
*/
protected void createCompleteMessageDialog() {
boolean result = MessageDialog.openConfirm(getShell(),
UMLMessage.MESSAGE_COMPLETE_DOCUMENT_CREATION,//"문서산출물 생성완료",
fileLocation +
UMLMessage.MESSAGE_DOCUMENT_HAS_BEEN_CREATED);//" 문서가 생성되었습니다. 생성된 문서를 보시겠습니까?");
if( result ) {
File file = new File(fileLocation);
if( file.exists() ) {
Program program = Program.findProgram(file.getName().substring(file.getName().lastIndexOf(UICoreConstant.PROJECT_CONSTANTS__DOT)));
if (null != program) {
String string = file.getAbsolutePath().toString();
program.execute(string);
}
}
}
}
示例7: createControls
import org.eclipse.swt.program.Program; //导入依赖的package包/类
protected void createControls() {
group = new Group(this, SWT.NONE);
group.setLayout(new GridLayout(3, false));
imageLabel = new Label(group, SWT.NONE);
GridDataFactory.fillDefaults().grab(false, false).align(SWT.BEGINNING, SWT.CENTER).applyTo(imageLabel);
textLabel = new Link(group, SWT.WRAP);
textLabel.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (DOWNLOAD_LINK.equals(e.text)) {
Program.launch(DOWNLOAD_LINK);
} else {
PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), PREF_PAGE_ID,
new String[] { DISPLAY_ID }, null);
dialog.setSelectedNode("DISPLAY_ID");
dialog.open();
}
}
});
GridDataFactory.fillDefaults().grab(true, false).align(SWT.CENTER, SWT.CENTER).applyTo(textLabel);
button = new Button(group, SWT.FLAT);
button.setText("Download");
GridDataFactory.fillDefaults().grab(false, false).align(SWT.END, SWT.CENTER).applyTo(button);
}
示例8: initialToolBar
import org.eclipse.swt.program.Program; //导入依赖的package包/类
private void initialToolBar() {
IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager();
toolBarManager.add(new Action("Save", ImageUtil.getImageDescriptor(Images.save)) {
@Override
public void run() {
saveContents();
}
});
toolBarManager.add(new Action("help", ImageUtil.getImageDescriptor(Images.help)) {
@Override
public void run() {
Program.launch(HelpConstants.HELP_ALERT_SCRIPT);
}
});
}
示例9: displayHelp
import org.eclipse.swt.program.Program; //导入依赖的package包/类
private void displayHelp() {
String curLang = CommonFunction.getSystemLanguage();
StringBuffer sbHelp = new StringBuffer("help");
if (Util.isWindows()) {
sbHelp.append(File.separator).append("csv2tbxdoc").append(File.separator);
if (curLang.equalsIgnoreCase("zh")) {
sbHelp.append("tbxmaker_zh-cn.chm");
} else {
sbHelp.append("tbxmaker.chm");
}
Program.launch(PluginUtil.getConfigurationFilePath(sbHelp.toString()));
} else {
sbHelp.append(File.separator).append("csv2tbxdoc").append(File.separator);
if (curLang.equalsIgnoreCase("zh")) {
sbHelp.append("zh-cn");
} else {
sbHelp.append("en");
}
sbHelp.append(File.separator).append("toc.xml");
PluginHelpDialog dialog = new PluginHelpDialog(getShell(), PluginUtil.getConfigurationFilePath(sbHelp.toString()),
Messages.getString("dialog.TBXMakerDialog.helpDialogTitle"));
dialog.open();
}
}
示例10: createMessageArea
import org.eclipse.swt.program.Program; //导入依赖的package包/类
@Override
protected Control createMessageArea(Composite composite) {
Image image = getImage();
if (image != null) {
imageLabel = new Label(composite, SWT.NULL);
image.setBackground(imageLabel.getBackground());
imageLabel.setImage(image);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(imageLabel);
}
if (message != null) {
Link link = new Link(composite, getMessageLabelStyle());
link.setText(message);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false)
.hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT).applyTo(link);
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Program.launch(linkUrl);
}
});
}
return composite;
}
示例11: menuEventsForecast
import org.eclipse.swt.program.Program; //导入依赖的package包/类
protected void menuEventsForecast() {
{
MenuItem eventForecast = new MenuItem(eventsSubMenu, SWT.CASCADE);
eventForecast.setText("Run a forecast based on technical analysis");
eventForecast.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
ActionDialog actionDialog = new ActionDialog(getShell(), "Info",
"Running a neural network forecast on technical analysis is not available in this version.\n"+
"This feature is part of the advanced version including "+MainGui.APP_NAME+" Forecast engine.\n",
null,
"Click here for more information and a workable demo",
new ActionDialogAction() {
@Override
public void action() {
Program.launch("http://"+siteUrl);
}
});
actionDialog.open();
}
});
}
}
示例12: buildPluginInfoCell
import org.eclipse.swt.program.Program; //导入依赖的package包/类
/**
* build plugin info cell.
*/
protected void buildPluginInfoCell() {
this.ascLink = new Link(this.dialog, SWT.NONE);
this.ascLink.setText(BaseMessages.getString(PKG, "SapInputDialog.About.Plugin.Info"));
GridData grdData = new GridData();
grdData.horizontalIndent = DEFAULT_INDENT;
grdData.verticalIndent = DEFAULT_INDENT;
this.ascLink.setLayoutData(grdData);
this.ascLink.addListener(SWT.Selection, new Listener() {
public void handleEvent(final Event event) {
Program.launch(event.text);
}
});
}
示例13: buildPluginInfoCell
import org.eclipse.swt.program.Program; //导入依赖的package包/类
/**
* build plugin info cell.
*/
protected void buildPluginInfoCell() {
this.ascLink = new Link(this.dialog, SWT.NONE);
this.ascLink.setText(BaseMessages.getString(PKG, "TeraFastDialog.About.Plugin.Info"));
GridData grdData = new GridData();
grdData.horizontalIndent = DEFAULT_INDENT;
grdData.verticalIndent = DEFAULT_INDENT;
this.ascLink.setLayoutData(grdData);
this.ascLink.addListener(SWT.Selection, new Listener() {
public void handleEvent(final Event event) {
Program.launch(event.text);
}
});
}
示例14: buildPluginInfoCell
import org.eclipse.swt.program.Program; //导入依赖的package包/类
/**
* build plugin info cell.
*/
protected void buildPluginInfoCell() {
this.ascLink = new Link(this.dialog, SWT.NONE);
this.ascLink.setText(BaseMessages.getString(PKG, "OlapInputDialog.About.Plugin.Info"));
GridData grdData = new GridData();
grdData.horizontalIndent = DEFAULT_INDENT;
grdData.verticalIndent = DEFAULT_INDENT;
this.ascLink.setLayoutData(grdData);
this.ascLink.addListener(SWT.Selection, new Listener() {
public void handleEvent(final Event event) {
Program.launch(event.text);
}
});
}
示例15: createDetailsMessage
import org.eclipse.swt.program.Program; //导入依赖的package包/类
protected void createDetailsMessage(Composite topControl, IDetailsMessage detailsMessage) {
if(!detailsMessage.getDetailsMessage2().isPresent()) {
return;
}
String additionalMessage = "\n" + detailsMessage.getDetailsMessage2().get();
helpControl = SWTFactoryUtil.createLink(topControl, SWT.WRAP, additionalMessage,
gdfFillDefaults().grab(true, true).span(2, 1).create()
);
helpControl.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String uri = e.text;
if(uri.startsWith("http")) {
Program.launch(uri);
} else if(uri.startsWith("pref:")) {
String prefId = StringUtil.removeStart("pref:", uri);
WorkbenchUtils.openPreferencePage(helpControl.getShell(), prefId);
} else {
UIOperationsStatusHandler.handleInternalError("Unknown link URI:\n" + uri, null);
}
}
});
}