org.eclipse.swt.program.Program Java Examples

The following examples show how to use org.eclipse.swt.program.Program. 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: LinkComposite.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
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 );
        }
    } );
}
 
Example #2
Source File: TBXMakerDialog.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
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();
	}

}
 
Example #3
Source File: OpenBubbleChartHandler.java    From slr-toolkit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

	// get selection
	ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
	if (selection == null || !(selection instanceof IStructuredSelection)) {
		return null;
	}
	List<BubbleDataContainer> data = processSelectionData((IStructuredSelection) selection);

	boolean dataWrittenSuccessfully = false;
	try {
		// overwrite csv with new data
		dataWrittenSuccessfully = overwriteCSVFile(data);
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

	// open website in default browser
	if (dataWrittenSuccessfully) {
		Program.launch(Activator.getUrl() + "bubble.index.html");
	}

	return null;
}
 
Example #4
Source File: OpenCiteHandler.java    From slr-toolkit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

	// get selection
	ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
	if (selection == null || !(selection instanceof IStructuredSelection)) {
		return null;
	}
	Map<String, Integer> data = processSelectionData((IStructuredSelection) selection);

	boolean dataWrittenSuccessfully = false;
	try {
		// overwrite csv with new data
		dataWrittenSuccessfully = overwriteCSVFile(data);
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

	// call website on writen file
	if (dataWrittenSuccessfully) {
		Program.launch(Activator.getUrl() + "bar.index.html");
	}

	return null;
}
 
Example #5
Source File: AuthorizationCodeInstalledAppTalend.java    From components with Apache License 2.0 6 votes vote down vote up
public static void browseWithProgramLauncher(String url) {
    Preconditions.checkNotNull(url);
    LOG.warn("Trying to open '{}'...", url);
    String osName = System.getProperty("os.name");
    String osNameMatch = osName.toLowerCase();
    if (osNameMatch.contains("linux")) {
        if (Program.findProgram("hmtl") == null) {
            try {
                Runtime.getRuntime().exec("xdg-open " + url);
                return;
            } catch (IOException e) {
                LOG.error("Failed to open url via xdg-open: {}.", e.getMessage());
            }
        }
    }
    Program.launch(url);
}
 
Example #6
Source File: MessageArea.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
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 = createPreferencePageDialog();
				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);
}
 
Example #7
Source File: UIFunctionsImpl.java    From BiglyBT with GNU General Public License v2.0 6 votes vote down vote up
@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))));
}
 
Example #8
Source File: SearchSubsUtils.java    From BiglyBT with GNU General Public License v2.0 6 votes vote down vote up
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]", Matcher.quoteReplacement(s));
			command = command.replace(" --", "");
			PluginInitializer.getDefaultInterface().getUtilities().createProcess(command + " -incognito");
		} catch (Exception e1) {
			e1.printStackTrace();
			Utils.launch(s);
		}
	} else {
		Utils.launch(s);
	}
}
 
Example #9
Source File: TBXMakerDialog.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
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();
	}

}
 
Example #10
Source File: AbstractPage.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
protected Link addInfoText(PageContainer container, Composite parent,
		String text) {
	Link link = new Link(parent, SWT.WRAP | SWT.MULTI);
	container.adapt(link);
	GridData layoutData = new GridData(GridData.FILL, GridData.BEGINNING,
			true, false, 2, 1);
	link.setLayoutData(layoutData);
	link.setText(text);
	link.addListener(SWT.Selection, event -> {
		try {
			if (event.text != null && event.text.length() > 0) {
				Program.launch(event.text);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	});

	return link;
}
 
Example #11
Source File: AbstractExampleTab.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private void createLinks(Composite parent) {
	parent.setLayout(new GridLayout());

	String[] links = createLinks();

	if (links == null) {
		return;
	}

	for (String link2 : links) {
		Link link = new Link(parent, SWT.NONE);
		link.setText(link2);
		link.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				Program.launch(e.text);
			}
		});
	}
}
 
Example #12
Source File: StatusMessageDialogExt.java    From goclipse with Eclipse Public License 1.0 6 votes vote down vote up
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);
			}
		}
	});
}
 
Example #13
Source File: ExternalLink.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public boolean doXRef(String refProvider, String refID){
	try {
		int r = refID.lastIndexOf('.');
		String ext = ""; //$NON-NLS-1$
		if (r != -1) {
			ext = refID.substring(r + 1);
		}
		Program proggie = Program.findProgram(ext);
		if (proggie != null) {
			proggie.execute(refID);
		} else {
			if (Program.launch(refID) == false) {
				Runtime.getRuntime().exec(refID);
			}
		}
	} catch (Exception ex) {
		ElexisStatus status =
			new ElexisStatus(ElexisStatus.ERROR, Hub.PLUGIN_ID, ElexisStatus.CODE_NONE,
				Messages.ExternalLink_CouldNotStartFile, ex);
		StatusManager.getManager().handle(status);
	}
	
	return true;
}
 
Example #14
Source File: StartEditLocalDocumentHandler.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
private void startEditLocal(Object object, ILocalDocumentService service, Shell parentShell){
	Optional<File> file = service.add(object, new IConflictHandler() {
		@Override
		public Result getResult(){
			if (MessageDialog.openQuestion(parentShell,
				Messages.StartEditLocalDocumentHandler_conflicttitle,
				Messages.StartEditLocalDocumentHandler_conflictmessage)) {
				return Result.KEEP;
			} else {
				return Result.OVERWRITE;
			}
		}
	});
	if (file.isPresent()) {
		Program.launch(file.get().getAbsolutePath());
	} else {
		MessageDialog.openError(parentShell, Messages.StartEditLocalDocumentHandler_errortitle,
			Messages.StartEditLocalDocumentHandler_errormessage);
	}
}
 
Example #15
Source File: DialogAbout.java    From arx with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a link.
 *
 * @param parent
 * @param text
 * @param tooltip
 * @param url
 */
private void createLink(Composite parent, String text, String tooltip, final String url){
    Link link = new Link(parent, SWT.NONE);
    link.setLayoutData(SWTUtil.createFillHorizontallyGridData());
    link.setText(text);
    link.setToolTipText(tooltip);
    link.setBackground(parent.getBackground());
    link.addListener (SWT.Selection, new Listener () {
        public void handleEvent(Event event) {
            try {
                Program.launch(url);
            } catch (Exception e){
                /* Ignore*/
            }
        }
    });
}
 
Example #16
Source File: WinDeviceStatusHandler.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
protected Control createDialogArea(Composite parent) {
	Composite composite = (Composite) super.createDialogArea(parent);
	GridLayout layout = (GridLayout) composite.getLayout();
	layout.numColumns = 1;
	Link desc = new Link(composite, SWT.NONE);
	desc.setText(Messages.WinDevicesStatusHandler_Message);
	desc.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			Program.launch(WinConstants.SDK_DOWNLOAD_URL);
		}
	});
	getShell().setText(Messages.WinDevicesStatusHandler_Title);
	return composite;
}
 
Example #17
Source File: OlapInputAboutDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * 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 );
    }
  } );
}
 
Example #18
Source File: TeraFastAboutDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * 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 );
    }
  } );
}
 
Example #19
Source File: XSLTransformationDialog.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void okPressed() {
	String strSourcePath = txtSource.getText();
	String strXSLPath = txtXSL.getText();
	String strTargetPath = txtTarget.getText();
	if (strSourcePath.equals("")) {
		MessageDialog.openInformation(getShell(), Messages.getString("dialog.XSLTransformationDialog.msgTitle"),
				Messages.getString("dialog.XSLTransformationDialog.msg1"));
		return;
	}
	if (strXSLPath.equals("")) {
		MessageDialog.openInformation(getShell(), Messages.getString("dialog.XSLTransformationDialog.msgTitle"),
				Messages.getString("dialog.XSLTransformationDialog.msg2"));
		return;
	}
	if (strTargetPath.equals("")) {
		MessageDialog.openInformation(getShell(), Messages.getString("dialog.XSLTransformationDialog.msgTitle"),
				Messages.getString("dialog.XSLTransformationDialog.msg3"));
		return;
	}

	try {
		transform(strSourcePath, strXSLPath, strTargetPath);
		MessageDialog.openInformation(getShell(), Messages.getString("dialog.XSLTransformationDialog.msgTitle"),
				Messages.getString("dialog.XSLTransformationDialog.msg4"));
		if (btnOpenFile.getSelection()) {
			if (!Program.launch(strTargetPath)) {
				MessageDialog.openInformation(getShell(),
						Messages.getString("dialog.XSLTransformationDialog.msgTitle"),
						Messages.getString("dialog.XSLTransformationDialog.msg5"));
			}
		}
		close();
	} catch (Exception e) {
		LOGGER.error(Messages.getString("dialog.XSLTransformationDialog.logger1"), e);
	}
}
 
Example #20
Source File: SelfHelpDisplay.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Displays the specified url. The url can contain query parameters to
 * identify how help displays the document
 */
private void displayHelpURL(String helpURL, boolean forceExternal) {
	if (!BaseHelpSystem.ensureWebappRunning()) {
		return;
	}
	if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_STANDALONE) {
		// wait for Display to be created
		SelfDisplayUtils.waitForDisplay();
	}

	try {
		if (helpURL == null || helpURL.length() == 0) {
			helpURL = getHelpDisplay().getHelpHome( WebappManager.getHost(),  WebappManager.getPort(), null);
		} else if (helpURL.startsWith("tab=")) { //$NON-NLS-1$
			String tab = helpURL.substring("tab=".length()); //$NON-NLS-1$
			helpURL = getHelpDisplay().getHelpHome( WebappManager.getHost(),  WebappManager.getPort(), tab);	
		} else if (helpURL.startsWith("topic=")) { //$NON-NLS-1$
			String topic = helpURL.substring("topic=".length()); //$NON-NLS-1$
			helpURL = getHelpDisplay().getHelpForTopic( topic, WebappManager.getHost(),  WebappManager.getPort());	
		} 
		
		
		String systemname = System.getProperty("os.name").toUpperCase();
		if (systemname.contains("LINUX") || systemname.contains("MAC OS X")) { 
			Program.launch(helpURL);
		}else if (systemname.contains("WINDOW")) { 
			BaseHelpSystem.getHelpBrowser(forceExternal).displayURL(helpURL);
		} 
		
	} catch (Exception e) {
		HelpBasePlugin
				.logError(
						"An exception occurred while launching help.  Check the log at " + Platform.getLogFileLocation().toOSString(), e); //$NON-NLS-1$
		BaseHelpSystem.getDefaultErrorUtil()
				.displayError(
						NLS.bind(HelpBaseResources.HelpDisplay_exceptionMessage, Platform.getLogFileLocation().toOSString()));
	}
}
 
Example #21
Source File: ImportProjectWizardPage2.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Image getImage(Object element) {
	if (element instanceof ProjectResource) {
		ProjectResource proResource = (ProjectResource) element;
		String fileName = proResource.getLabel();
		if (proResource.isProject()) {
			return projectImg;
		} else if (proResource.isFolder()) {
			return folderImg;
		} else if (fileName.endsWith(".hsxliff")) {
			return hsXLiffImg;
		} else if (fileName.endsWith(".html")) {
			return htmlImg;
		} else {
			int index = fileName.lastIndexOf(".");
			if (index != -1) {
				String extension = fileName.substring(index, fileName.length());
				if (imgMap.containsKey(extension)) {
					return imgMap.get(extension);
				}
				Program program = Program.findProgram(extension);
				if (program != null) {
					ImageData imageData = program.getImageData();
					if (imageData != null) {
						Image img = new Image(getShell().getDisplay(), imageData);
						imgMap.put(extension, img);
						return img;
					}
				}
			}
		}
	}
	return defaultImg;
}
 
Example #22
Source File: WinEmulatorStatusHandler.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
protected Control createDialogArea(Composite parent) {
	Composite composite = (Composite) super.createDialogArea(parent);
	GridLayout layout = (GridLayout) composite.getLayout();
	layout.numColumns = 1;
	Link desc = new Link(composite, SWT.NONE);
	desc.setText(Messages.WinEmulatorsStatusHandler_Message);
	desc.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			Program.launch(WinConstants.SDK_DOWNLOAD_URL);
		}
	});
	getShell().setText(Messages.WinEmulatorsStatusHandler_Title);
	return composite;
}
 
Example #23
Source File: WinSimulatorStatusHandler.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
protected Control createDialogArea(Composite parent) {
	Composite composite = (Composite) super.createDialogArea(parent);
	GridLayout layout = (GridLayout) composite.getLayout();
	layout.numColumns = 1;
	Link desc = new Link(composite, SWT.NONE);
	desc.setText(Messages.WinSimulatorsStatusHandler_Message);
	desc.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			Program.launch(WinConstants.SDK_DOWNLOAD_URL);
		}
	});
	getShell().setText(Messages.WinSimulatorsStatusHandler_Title);
	return composite;
}
 
Example #24
Source File: XSLTransformationDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void okPressed() {
	String strSourcePath = txtSource.getText();
	String strXSLPath = txtXSL.getText();
	String strTargetPath = txtTarget.getText();
	if (strSourcePath.equals("")) {
		MessageDialog.openInformation(getShell(), Messages.getString("dialog.XSLTransformationDialog.msgTitle"),
				Messages.getString("dialog.XSLTransformationDialog.msg1"));
		return;
	}
	if (strXSLPath.equals("")) {
		MessageDialog.openInformation(getShell(), Messages.getString("dialog.XSLTransformationDialog.msgTitle"),
				Messages.getString("dialog.XSLTransformationDialog.msg2"));
		return;
	}
	if (strTargetPath.equals("")) {
		MessageDialog.openInformation(getShell(), Messages.getString("dialog.XSLTransformationDialog.msgTitle"),
				Messages.getString("dialog.XSLTransformationDialog.msg3"));
		return;
	}

	try {
		transform(strSourcePath, strXSLPath, strTargetPath);
		MessageDialog.openInformation(getShell(), Messages.getString("dialog.XSLTransformationDialog.msgTitle"),
				Messages.getString("dialog.XSLTransformationDialog.msg4"));
		if (btnOpenFile.getSelection()) {
			if (!Program.launch(strTargetPath)) {
				MessageDialog.openInformation(getShell(),
						Messages.getString("dialog.XSLTransformationDialog.msgTitle"),
						Messages.getString("dialog.XSLTransformationDialog.msg5"));
			}
		}
		close();
	} catch (Exception e) {
		LOGGER.error(Messages.getString("dialog.XSLTransformationDialog.logger1"), e);
	}
}
 
Example #25
Source File: WinBuildStatusHandler.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
protected Control createDialogArea(Composite parent) {
	Composite composite = (Composite) super.createDialogArea(parent);
	GridLayout layout = (GridLayout) composite.getLayout();
	layout.numColumns = 1;
	Link desc = new Link(composite, SWT.NONE);
	desc.setText(Messages.WinBuildStatusHandler_Message);
	desc.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			Program.launch(WinConstants.SDK_DOWNLOAD_URL);
		}
	});
	getShell().setText(Messages.WinBuildStatusHandler_Title);
	return composite;
}
 
Example #26
Source File: MSBuildStatusHandler.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
protected Control createDialogArea(Composite parent) {
	Composite composite = (Composite) super.createDialogArea(parent);
	GridLayout layout = (GridLayout) composite.getLayout();
	layout.numColumns = 1;
	Link desc = new Link(composite, SWT.NONE);
	desc.setText(Messages.MSBuildStatusHandler_Message);
	desc.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			Program.launch(WPConstants.SDK_DOWNLOAD_URL);
		}
	});
	getShell().setText(Messages.MSBuildStatusHandler_Title);
	return composite;
}
 
Example #27
Source File: EmulatorsStatusHandler.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
protected Control createDialogArea(Composite parent) {
	Composite composite = (Composite) super.createDialogArea(parent);
	GridLayout layout = (GridLayout) composite.getLayout();
	layout.numColumns = 1;
	Link desc = new Link(composite, SWT.NONE);
	desc.setText(Messages.EmulatorsStatusHandler_Message);
	desc.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			Program.launch(WPConstants.SDK_DOWNLOAD_URL);
		}
	});
	getShell().setText(Messages.EmulatorsStatusHandler_Title);
	return composite;
}
 
Example #28
Source File: OpenEngineLogCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Boolean execute(final ExecutionEvent event) throws ExecutionException {
    final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    final File logFile = BOSWebServerManager.getInstance().getBonitaLogFile();
    if (logFile != null && logFile.exists()) {
        IFileStore fileStore;
        try {
            fileStore = EFS.getLocalFileSystem().getStore(logFile.toURI());
            final File localFile = fileStore.toLocalFile(EFS.NONE, Repository.NULL_PROGRESS_MONITOR);
            final long fileSize = localFile.length();
            if (fileSize < MAX_FILE_SIZE) {
                IDE.openEditorOnFileStore(page, fileStore);
            } else {
                Program textEditor = Program.findProgram("log");
                if (textEditor == null) {
                    textEditor = Program.findProgram("txt");
                }
                if (textEditor != null) {
                    final boolean success = textEditor.execute(localFile.getAbsolutePath());
                    if (!success) {
                        showWarningMessage(localFile);
                    }
                } else {
                    showWarningMessage(localFile);
                }
            }

            return Boolean.TRUE;
        } catch (final Exception e) {
            BonitaStudioLog.error(e);
            return Boolean.FALSE;
        }
    } else {
        MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                Messages.unableTofindLogTitle, Messages.unableTofindLogMessage);
        return Boolean.FALSE;
    }
}
 
Example #29
Source File: OpenUIDLogCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Boolean execute(ExecutionEvent event) throws ExecutionException {
    final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    final Optional<File> logFile = UIDesignerServerManager.getInstance().getLogFile();
    if (logFile.isPresent() && logFile.get().exists()) {
        try {
            IFileStore fileStore = EFS.getLocalFileSystem().getStore(logFile.get().toURI());
            final File localFile = fileStore.toLocalFile(EFS.NONE, Repository.NULL_PROGRESS_MONITOR);
            final long fileSize = localFile.length();
            if (fileSize < MAX_FILE_SIZE) {
                IDE.openEditorOnFileStore(page, fileStore);
            } else {
                Program textEditor = Program.findProgram("log");
                if (textEditor == null) {
                    textEditor = Program.findProgram("txt");
                }
                if (textEditor == null || !textEditor.execute(localFile.getAbsolutePath())) {
                    showWarningMessage(localFile);
                }
            }
            return true;
        } catch (final Exception e) {
            BonitaStudioLog.error(e);
            return false;
        }
    }
    MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
            Messages.unableTofindLogTitle, Messages.unableTofindLogMessage);
    return false;
}
 
Example #30
Source File: SapInputAboutDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * 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 );
    }
  } );
}