当前位置: 首页>>代码示例>>Java>>正文


Java MessageConsoleStream类代码示例

本文整理汇总了Java中org.eclipse.ui.console.MessageConsoleStream的典型用法代码示例。如果您正苦于以下问题:Java MessageConsoleStream类的具体用法?Java MessageConsoleStream怎么用?Java MessageConsoleStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MessageConsoleStream类属于org.eclipse.ui.console包,在下文中一共展示了MessageConsoleStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getConsoleOutputStream

import org.eclipse.ui.console.MessageConsoleStream; //导入依赖的package包/类
public OutputStream getConsoleOutputStream(boolean isError) {
	final MessageConsoleStream output = messageConsole.newMessageStream();
	output.setActivateOnWrite(false);
	
	final int colorId;
	if (!isError) {
		colorId = SWT.COLOR_BLACK;
	} else {
		colorId = SWT.COLOR_RED;
	}
	
	/* we must set the color in the UI thread */
	Runnable runnable = new Runnable() {
		public void run() {
			org.eclipse.swt.graphics.Color color = Display.getCurrent()
					.getSystemColor(colorId);
			output.setColor(color);
		}
	};
	Display.getDefault().syncExec(runnable);
	
	return output;
}
 
开发者ID:kwin,项目名称:cppcheclipse,代码行数:24,代码来源:Console.java

示例2: getOutputStream

import org.eclipse.ui.console.MessageConsoleStream; //导入依赖的package包/类
@Override
public OutputStream getOutputStream(final OutputStreamType type, OutputRedirection redirect) {
	if (!PlatformUI.isWorkbenchRunning()) {
		return DEFAULT.getOutputStream(type, redirect);
	}
	final MessageConsole console = consoleSupplier.get();
	boolean silent = redirect == OutputRedirection.SUPPRESS;
	if (!silent) {
		console.activate();
	}
	ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { console });
	final MessageConsoleStream stream = console.newMessageStream();
	getDisplay().asyncExec(() -> {
		stream.setColor(toColor(type));
		showConsoleView(silent);
	});
	return stream;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:ConsoleOutputStreamProvider.java

示例3: setUpDeployCloudSdk

import org.eclipse.ui.console.MessageConsoleStream; //导入依赖的package包/类
/**
 * Sets up a {@link CloudSdk} to be used for App Engine deploy.
 */
public void setUpDeployCloudSdk(Path credentialFile, MessageConsoleStream normalOutputStream) {
  Preconditions.checkNotNull(credentialFile, "credential required for deploying");
  Preconditions.checkArgument(Files.exists(credentialFile), "non-existing credential file");
  Preconditions.checkState(cloudSdk == null, "CloudSdk already set up");

  // Structured deploy result (in JSON format) goes to stdout, so prepare to capture that.
  stdOutCaptor = new StringBuilderProcessOutputLineListener();
  // Structured gcloud logs (in JSON format) go to stderr, so prepare to capture them.
  gcloudErrorMessageCollector = new GcloudStructuredLogErrorMessageCollector();

  // Normal operation output goes to stderr.
  MessageConsoleStream stdErrOutputStream = normalOutputStream;
  CloudSdk.Builder cloudSdkBuilder = getBaseCloudSdkBuilder(stdErrOutputStream)
      .appCommandCredentialFile(credentialFile.toFile())
      .appCommandShowStructuredLogs("always")  // turns on gcloud structured log
      .addStdErrLineListener(gcloudErrorMessageCollector)
      .addStdOutLineListener(stdOutCaptor);
  cloudSdk = cloudSdkBuilder.build();
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:23,代码来源:CloudSdkProcessWrapper.java

示例4: stage

import org.eclipse.ui.console.MessageConsoleStream; //导入依赖的package包/类
@Override
public IStatus stage(IPath stagingDirectory, IPath safeWorkDirectory,
    MessageConsoleStream stdoutOutputStream, MessageConsoleStream stderrOutputStream,
    IProgressMonitor monitor) {
  SubMonitor subMonitor = SubMonitor.convert(monitor, 100);

  boolean result = stagingDirectory.toFile().mkdirs();
  if (!result) {
    return StatusUtil.error(this, "Could not create staging directory " + stagingDirectory);
  }

  try {
    IPath deployArtifact = getDeployArtifact(safeWorkDirectory, subMonitor.newChild(40));
    CloudSdkStagingHelper.stageFlexible(appEngineDirectory, deployArtifact, stagingDirectory,
        subMonitor.newChild(60));
    return Status.OK_STATUS;
  } catch (AppEngineException | CoreException ex) {
    return StatusUtil.error(this, Messages.getString("deploy.job.staging.failed"), ex);
  } finally {
    subMonitor.done();
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:23,代码来源:FlexStagingDelegate.java

示例5: initializeDevServer

import org.eclipse.ui.console.MessageConsoleStream; //导入依赖的package包/类
private void initializeDevServer(MessageConsoleStream stdout, MessageConsoleStream stderr,
    Path javaHomePath) {
  MessageConsoleWriterOutputLineListener stdoutListener =
      new MessageConsoleWriterOutputLineListener(stdout);
  MessageConsoleWriterOutputLineListener stderrListener =
      new MessageConsoleWriterOutputLineListener(stderr);

  // dev_appserver output goes to stderr
  cloudSdk = new CloudSdk.Builder()
      .javaHome(javaHomePath)
      .addStdOutLineListener(stdoutListener).addStdErrLineListener(stderrListener)
      .addStdErrLineListener(serverOutputListener)
      .startListener(localAppEngineStartListener)
      .exitListener(localAppEngineExitListener)
      .async(true)
      .build();

  devServer = LocalAppEngineServerLaunchConfigurationDelegate.DEV_APPSERVER2
      ? new CloudSdkAppEngineDevServer2(cloudSdk)
      : new CloudSdkAppEngineDevServer1(cloudSdk);
  moduleToUrlMap.clear();
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:23,代码来源:LocalAppEngineServerBehaviour.java

示例6: RemoteUtility

import org.eclipse.ui.console.MessageConsoleStream; //导入依赖的package包/类
public RemoteUtility(
		String hostName, 
		String userName, 
		String userPassword,
		MessageConsoleStream consoleStream) {
	
	// Setting attributes
	setHostName(hostName);
	setUserName(userName);
	setUserPassword(userPassword);
	setConsoleStream(consoleStream);
	
	setConnection(new Connection(getHostName()));
	
	setVerboseMode(false);
}
 
开发者ID:ncleclipse,项目名称:ncl30-eclipse,代码行数:17,代码来源:RemoteUtility.java

示例7: execute

import org.eclipse.ui.console.MessageConsoleStream; //导入依赖的package包/类
@Override
public Object execute(ExecutionEvent event) {
	
	try {
		this.showConsole(event);
		this.clearConsole();
		
		IFile file = this.getSelectedFile(event);
		String umlModelPath = file.getLocation().toFile().getAbsolutePath();
		String toscaModelPath = file.getLocation().toFile().getAbsolutePath();
		toscaModelPath = toscaModelPath.replace(".uml", ".tosca");
		
		MessageConsoleStream outStream = console.newMessageStream();
		outStream.println("Translating " + umlModelPath + " into " + toscaModelPath);
		
		CAML2TOSCALauncher launcher = new CAML2TOSCALauncher();
		launcher.runCAML2TOSCATemplates(umlModelPath, toscaModelPath);
		
		outStream.println("Done ;)");
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
	
	return null;
}
 
开发者ID:alexander-bergmayr,项目名称:caml2tosca,代码行数:26,代码来源:C2TRunHandler.java

示例8: run

import org.eclipse.ui.console.MessageConsoleStream; //导入依赖的package包/类
public void run() {
	try {
		ISelection selection = treeViewer.getSelection();
		Object obj = ((IStructuredSelection) selection).getFirstElement();

		if (obj instanceof Test) {
			if (((Test) obj).getStatus().equals("Actual run")) {
				((Test) obj).setStatus("Not run");
				treeViewer.refresh();
				treeViewer.expandAll();

				Runtime.getRuntime().exec("taskkill /F /IM python.exe");
				MessageConsoleStream out = ConsoleManager
						.getMessageConsoleStream("Console");
				out.println("Test Stop");
				
				runTestAction.setEnabled(true);
				this.setEnabled(false);
			}
		}

	} catch (IOException e) {
		e.printStackTrace();
	}

}
 
开发者ID:FutureProcessing,项目名称:RFRunnerPlugin,代码行数:27,代码来源:StopTestAction.java

示例9: writeToConsole

import org.eclipse.ui.console.MessageConsoleStream; //导入依赖的package包/类
/**
 * Displays the specified text at the console, followed by a line
 * separator string.
 * 
 * @param text message to display
 * @param lineBreak <tt>true</tt> if a linebreak shall be inserted after the message.
 * @return <tt>true</tt> if the message was successfully displayed inside the console.
 */
public boolean writeToConsole(String text, boolean lineBreak) {
    boolean isWritten = false;
    if (this.msgConsole != null) {
        MessageConsoleStream out = this.msgConsole.newMessageStream();
        if (lineBreak) {
            out.println(text);
        } else {
            out.print(text);
        }
        try {
            out.flush();
            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    return isWritten;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:27,代码来源:EclipseConsole.java

示例10: run

import org.eclipse.ui.console.MessageConsoleStream; //导入依赖的package包/类
/**
 * Runs the compiler on the selected files using the given processor
 * 
 * @param fileNames
 *            files that need to be type-checked
 * @param processors
 *            Type processors to run
 * @param classpath
 *            The classpath to reference in compilation
 */

public void run()
{
    Iterable<String> opts;

    opts = getOptions(processors, classpath);

    // The following code uses the compiler's internal APIs, which are
    // volatile. (see warning in JavacTool source)
    JavacTool tool = JavacTool.create();
    JavacFileManager manager = tool.getStandardFileManager(collector, null, null);

    Iterable<? extends JavaFileObject> fileObjs = manager.getJavaFileObjectsFromStrings(fileNames);

    CheckerPlugin.getDefault();
    MessageConsole console = CheckerPlugin.findConsole();
    MessageConsoleStream stream = console.newMessageStream();
    Writer writer = new OutputStreamWriter(stream);

    JavacTask task = tool.getTask(writer, manager, collector, opts, null, fileObjs);

    task.call();
    manager.close();
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:35,代码来源:JavacRunner.java

示例11: getNewMessageConsoleStream

import org.eclipse.ui.console.MessageConsoleStream; //导入依赖的package包/类
private MessageConsoleStream getNewMessageConsoleStream(int msgKind)
{     
    int swtColorId = SWT.COLOR_DARK_GREEN;
    
    switch (msgKind) {
        case MSG_INFORMATION:
            swtColorId = SWT.COLOR_BLACK;
            break;
            
        case MSG_ERROR:
            swtColorId = SWT.COLOR_RED;
            break;
            
        case MSG_WARNING:
            swtColorId = SWT.COLOR_DARK_BLUE;
            break;
            
        default:          
            swtColorId = SWT.COLOR_DARK_MAGENTA;
    }  
    
    MessageConsoleStream msgConsoleStream = getMessageConsole().newMessageStream();     
    msgConsoleStream.setColor(Display.getCurrent().getSystemColor(swtColorId));
    return msgConsoleStream;
}
 
开发者ID:Elphel,项目名称:vdt-plugin,代码行数:26,代码来源:ConsoleView.java

示例12: checkDescParameters

import org.eclipse.ui.console.MessageConsoleStream; //导入依赖的package包/类
/**
 * Checks Description string.
 * @param name the node name.
 * @param desc the description.
 */
private void checkDescParameters(String name, String desc) {
	Pattern p = Pattern.compile("\\{([^\\}]+)\\}"); //$NON-NLS-1$
	ArrayList<String> paramList = new ArrayList<String>();
	while (true) {
		Matcher m = p.matcher(desc);
		if (! m.find()) {
			break;
		}
		String parameter = m.group(1);
		paramList.add(parameter);
		desc = desc.replaceAll(String.format(PARAM_ITEM_REGEX_FORMAT, parameter), ""); //$NON-NLS-1$
	}
	// found unknown parameters.
	if (paramList.size() > 0) {
		MessageConsoleStream stream = DcaseNodeEditPart.getMessageConsoleStream();
		stream.print(name + ": cannot found "); //$NON-NLS-1$
		for (int i = 0; i < paramList.size(); i++) {
			stream.print(paramList.get(i) + ((i == paramList.size()-1) ? "":",")); //$NON-NLS-1$
		}
		stream.println();
	}
}
 
开发者ID:d-case,项目名称:d-case_editor,代码行数:28,代码来源:BasicNodeOpenEditPolicy.java

示例13: getNewMessageConsoleStream

import org.eclipse.ui.console.MessageConsoleStream; //导入依赖的package包/类
private MessageConsoleStream getNewMessageConsoleStream(int msgKind) {
	int swtColorId = SWT.COLOR_BLACK;

	switch (msgKind) {
	case MSG_LOG:
		swtColorId = SWT.COLOR_BLACK;
		break;
	case MSG_INFORMATION:
		swtColorId = SWT.COLOR_DARK_GRAY;
		break;
	case MSG_ERROR:
		swtColorId = SWT.COLOR_DARK_MAGENTA;
		break;
	case MSG_WARNING:
		swtColorId = SWT.COLOR_DARK_YELLOW;
		break;
	case MSG_SUCCESS:
		swtColorId = SWT.COLOR_DARK_GREEN;
		break;
	default:
		swtColorId = SWT.COLOR_BLACK;
		break;
	}

	MessageConsoleStream msgConsoleStream = messageConsole.newMessageStream();
	msgConsoleStream.setColor(Display.getCurrent().getSystemColor(swtColorId));

	return msgConsoleStream;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:30,代码来源:XpectConsole.java

示例14: ConsoleContext

import org.eclipse.ui.console.MessageConsoleStream; //导入依赖的package包/类
public ConsoleContext ( final MessageConsole messageConsole )
{
    this.writerStream = messageConsole.newMessageStream ();

    final MessageConsoleStream errorStream = messageConsole.newMessageStream ();
    errorStream.setColor ( Display.getDefault ().getSystemColor ( SWT.COLOR_RED ) );
    this.errorPrintWriter = new PrintWriter ( new OutputStreamWriter ( errorStream ) );

    this.logStream = messageConsole.newMessageStream ();
    this.logStream.setColor ( Display.getDefault ().getSystemColor ( SWT.COLOR_GRAY ) );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:12,代码来源:ConsoleContext.java

示例15: createConsoles

import org.eclipse.ui.console.MessageConsoleStream; //导入依赖的package包/类
private void createConsoles() {
	ConsolePlugin consolePlugin = ConsolePlugin.getDefault();
	IConsoleManager consoleManager = consolePlugin.getConsoleManager();
	
	stdoutConsole = new MessageConsole("Stdout", ImageDescriptor.createFromFile(getClass(), "/consoles/stdout.gif"));
	stdoutConsole.setTabWidth(TAB_WIDTH);
	stdoutConsoleStream = stdoutConsole.newMessageStream();
	stderrConsoleStream = stdoutConsole.newMessageStream();
	stderrConsoleStream.setColor(stderrConsoleStreamColor);
	
	engineConsole = new MessageConsole("Engine", ImageDescriptor.createFromFile(getClass(), "/consoles/engine.gif"));
	engineConsole.setTabWidth(TAB_WIDTH);
	engineConsoleStream = engineConsole.newMessageStream();

	consoleManager.addConsoles(new IConsole[] {
		engineConsole,
		stdoutConsole
	});
	
	consolePipes = new ConsolePipes();
	
	debugConsoleStream = new MessageConsoleStream(engineConsole) {

		@Override
		public void write(String str) throws IOException {
			if (str.endsWith("\n")) {
				str = str.substring(0, str.length() - 1);
			}
			Engine.logStudio.info("[debug] " + str);
		}
		
	};
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:34,代码来源:ConvertigoPlugin.java


注:本文中的org.eclipse.ui.console.MessageConsoleStream类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。