Java Code Examples for org.eclipse.core.runtime.NullProgressMonitor

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project acceleo-modules, under directory /psm-gen-scala/plugins/com.github.sbegaudeau.acceleo.modules.psm.gen.scala.editor/src-gen/com/github/sbegaudeau/acceleo/modules/psm/gen/scala/model/scala/presentation/.

Source file: ScalaEditor.java

  21 
vote

/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
protected void doSaveAs(URI uri,IEditorInput editorInput){
  (editingDomain.getResourceSet().getResources().get(0)).setURI(uri);
  setInputWithNotify(editorInput);
  setPartName(editorInput.getName());
  IProgressMonitor progressMonitor=getActionBars().getStatusLineManager() != null ? getActionBars().getStatusLineManager().getProgressMonitor() : new NullProgressMonitor();
  doSave(progressMonitor);
}
 

Example 2

From project acceleo-webapp-generator, under directory /plugins/org.eclipse.acceleo.tutorial.webapp.editor/src-gen/org/eclipse/acceleo/tutorial/webapp/presentation/.

Source file: WebappEditor.java

  21 
vote

/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
protected void doSaveAs(URI uri,IEditorInput editorInput){
  (editingDomain.getResourceSet().getResources().get(0)).setURI(uri);
  setInputWithNotify(editorInput);
  setPartName(editorInput.getName());
  IProgressMonitor progressMonitor=getActionBars().getStatusLineManager() != null ? getActionBars().getStatusLineManager().getProgressMonitor() : new NullProgressMonitor();
  doSave(progressMonitor);
}
 

Example 3

From project bioclipse.opentox, under directory /plugins/net.bioclipse.opentox/src/net/bioclipse/opentox/business/.

Source file: OpentoxManager.java

  21 
vote

public Map<String,String> getFeatureInfo(String ontologyServer,String feature,IProgressMonitor monitor){
  if (monitor == null)   monitor=new NullProgressMonitor();
  monitor.beginTask("Downloading feature information",1);
  Map<String,String> properties=Feature.getProperties(ontologyServer,feature);
  monitor.done();
  return properties;
}
 

Example 4

From project bioclipse.speclipse, under directory /plugins/net.bioclipse.nmrshiftdb/src/net/bioclipse/nmrshiftdb/util/.

Source file: NmrshiftdbUtils.java

  21 
vote

public static IFolder createVirtualFolder() throws CoreException {
  final IProject root=net.bioclipse.core.Activator.getVirtualProject();
  int counter=1;
  String folderName=NMRSHIFTDB_FOLDER_NAME + " " + counter;
  while (root.exists(new Path(folderName))) {
    counter++;
    folderName=NMRSHIFTDB_FOLDER_NAME + " " + counter;
  }
  root.getFolder(folderName).create(true,true,new NullProgressMonitor());
  return root.getFolder(folderName);
}
 

Example 5

From project bioclipse.vscreen, under directory /net.bioclipse.vscreen.tests/src/net/bioclipse/vscreen/tests/.

Source file: AbstractVScreenManagerPluginTest.java

  21 
vote

@Before public void initialize() throws IOException, CoreException, BioclipseException, URISyntaxException {
  sdb=Activator.getDefault().getStructuredbManager();
  if (sdb.allDatabaseNames().contains(TEST_DB_NAME)) {
    sdb.deleteDatabase(TEST_DB_NAME,new NullProgressMonitor());
  }
  sdb.createDatabase(TEST_DB_NAME);
  IFile file=null;
  URI uri=getClass().getResource(TEST_FILE).toURI();
  URL url=FileLocator.toFileURL(uri.toURL());
  String path=url.getFile();
  file=FileUtil.createLinkedFile(path);
  sdb.addMoleculesFromSDF(TEST_DB_NAME,file);
}
 

Example 6

From project bndtools, under directory /bndtools.release/src/bndtools/release/api/.

Source file: ReleaseUtils.java

  21 
vote

/** 
 * If the bundle repository is shared e.g. CVS, this will return the remote file revision if it exists
 * @param repository
 * @param jar
 * @return The file revision or <code>null</code> if the bundle repository is not shared or the Jar does not exist in the remote repository
 */
public static IFileRevision getTeamRevision(RepositoryPlugin repository,Jar jar){
  IFolder repoRoot=ReleaseUtils.getLocalRepoLocation(repository);
  IProject repoProject=repoRoot.getProject();
  RepositoryProvider repoProvider=RepositoryProvider.getProvider(repoProject);
  if (repoProvider == null) {
    return null;
  }
  IFile path=getJarFileLocation(repository,jar);
  IFileRevision[] revs=getTeamRevisions(path,IFileHistoryProvider.SINGLE_REVISION,new NullProgressMonitor());
  if (revs == null) {
    return null;
  }
  return revs.length == 0 ? null : revs[0];
}
 

Example 7

From project bpelunit, under directory /tycho/net.bpelunit.toolsupport/editors/.

Source file: BPELUnitEditor.java

  21 
vote

private void preSave(){
  if (this.getCurrentPage() == VISUAL_PAGE) {
    this.fTestSuitePage.doSave(new NullProgressMonitor());
    this.model2src(true);
  }
}
 

Example 8

From project bundlemaker, under directory /main/org.bundlemaker.core/src/org/bundlemaker/core/internal/modules/modularizedsystem/.

Source file: AbstractTransformationAwareModularizedSystem.java

  21 
vote

/** 
 * {@inheritDoc}
 */
@Override public void applyTransformations(IProgressMonitor progressMonitor,List<ITransformation> transformations){
  Assert.isNotNull(transformations);
  if (progressMonitor == null) {
    progressMonitor=new NullProgressMonitor();
  }
  SubMonitor subMonitor=SubMonitor.convert(progressMonitor);
  subMonitor.beginTask("Transforming Module '" + getName() + "'",100);
  _applyTransformations(subMonitor,transformations.toArray(new ITransformation[0]));
}
 

Example 9

From project ceylon-ide-eclipse, under directory /plugins/com.redhat.ceylon.eclipse.ui/src/com/redhat/ceylon/eclipse/code/editor/.

Source file: TerminateStatementAction.java

  21 
vote

private CeylonParseController parse(){
  CeylonParseController cpc=new CeylonParseController();
  cpc.initialize(editor.getParseController().getPath(),editor.getParseController().getProject(),null);
  cpc.parse(editor.getCeylonSourceViewer().getDocument(),new NullProgressMonitor(),null);
  return cpc;
}
 

Example 10

From project Database-Designer, under directory /plugins/org.obeonetwork.dsl.database.editor/src/org/obeonetwork/dsl/database/presentation/.

Source file: DatabaseEditor.java

  21 
vote

/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
protected void doSaveAs(URI uri,IEditorInput editorInput){
  (editingDomain.getResourceSet().getResources().get(0)).setURI(uri);
  setInputWithNotify(editorInput);
  setPartName(editorInput.getName());
  IProgressMonitor progressMonitor=getActionBars().getStatusLineManager() != null ? getActionBars().getStatusLineManager().getProgressMonitor() : new NullProgressMonitor();
  doSave(progressMonitor);
}
 

Example 11

From project dawn-isenciaui, under directory /com.isencia.passerelle.workbench.model.editor.ui/src/main/java/com/isencia/passerelle/workbench/model/editor/ui/editor/.

Source file: PasserelleModelMultiPageEditor.java

  21 
vote

/** 
 * Calculates the contents of page 2 when the it is activated.
 */
protected void pageChange(int newPageIndex){
  getRefreshCommand().setModel(getDiagram());
  getRefreshCommand().execute();
  if (outlinePage != null)   outlinePage.switchThumbnail(newPageIndex);
  if (newPageIndex == 1) {
    doSave(new NullProgressMonitor());
  }
  super.pageChange(newPageIndex);
}
 

Example 12

From project dawn-ui, under directory /org.dawb.workbench.ui/src/org/dawb/workbench/ui/editors/actions/.

Source file: HightlightWorkflowHandler.java

  21 
vote

private void toggleHighlightSelection(){
  final boolean isSel=store.getBoolean(EditorConstants.HIGHLIGHT_ACTORS_CHOICE);
  store.setValue(EditorConstants.HIGHLIGHT_ACTORS_CHOICE,!isSel);
  IWorkspace ws=ResourcesPlugin.getWorkspace();
  try {
    ws.save(true,new NullProgressMonitor());
  }
 catch (  CoreException e) {
    logger.error("Cannot save workspace",e);
  }
}
 

Example 13

From project dawn-workflow, under directory /org.dawb.passerelle.actors/src/org/dawb/passerelle/actors/edna/.

Source file: AbstractEdnaPlugin.java

  21 
vote

private IFolder getEdnaXmlFolder() throws Exception {
  final IContainer cont=getProject();
  final IFolder edna=cont.getFolder(new Path("edna-xml"));
  if (!edna.exists()) {
    try {
      edna.create(true,true,new NullProgressMonitor());
    }
 catch (    Exception ne) {
      logger.error("Did not create new folder " + edna.getName(),ne);
    }
  }
  return edna;
}
 

Example 14

From project Diver, under directory /ca.uvic.chisel.diver.sequencediagram.sc/src/ca/uvic/chisel/diver/sequencediagrams/sc/java/model/.

Source file: ASTUTils.java

  21 
vote

/** 
 * @param classFile
 * @return
 */
public static ASTNode getASTFor(IClassFile unit){
  if (!unit.isOpen()) {
    try {
      unit.open(new NullProgressMonitor());
    }
 catch (    JavaModelException e) {
      StaticSequenceEditorPlugin.getDefault().getLog().log(e.getStatus());
    }
  }
  parser.setSource(unit);
  parser.setResolveBindings(true);
  return parser.createAST(new NullProgressMonitor());
}
 

Example 15

From project dolphin, under directory /org.adarsh.jutils/src/org/adarsh/jutils/internal/.

Source file: SourceManipulator.java

  21 
vote

/** 
 * Writes the toString implementation alongwith it's JavaDoc into the compilation unit.
 * @param compUnit the compilation unit (Java source file).
 * @throws JUtilsException in case of any errors during the operation.
 */
public static void createDummySetterWithJavaDoc(IType type,final String generated) throws JUtilsException {
  IProgressMonitor monitor=new NullProgressMonitor();
  try {
    type.createMethod("public void dummy() {\n" + generated + "}\n",null,true,monitor);
  }
 catch (  JavaModelException e) {
    throw new JUtilsException("Type " + type.getElementName() + " generated exception",e);
  }
}
 

Example 16

From project dozer, under directory /eclipse-plugin/net.sf.dozer.eclipse.plugin/src/org/dozer/eclipse/plugin/sourcepage/validation/.

Source file: Validator.java

  21 
vote

private boolean checkClassImplementsCustomConverter(IProject project,String className) throws JavaModelException {
  IType javaType=JdtUtils.getJavaType(project,className);
  if (javaType == null)   return false;
  ITypeHierarchy hierarchy=javaType.newSupertypeHierarchy(new NullProgressMonitor());
  IType[] interfaces=hierarchy.getAllSuperInterfaces(javaType);
  for (  IType type : interfaces) {
    if (type.getElementName().equals("CustomConverter")) {
      return true;
    }
  }
  return false;
}
 

Example 17

From project droolsjbpm-tools, under directory /drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/editors/.

Source file: DRLSourceViewerConfig.java

  21 
vote

public IReconciler getReconciler(ISourceViewer sourceViewer){
  MonoReconciler reconciler=null;
  if (sourceViewer != null) {
    reconciler=new MonoReconciler(new DRLReconcilingStrategy(sourceViewer,editor),false);
    reconciler.setDelay(500);
    reconciler.setProgressMonitor(new NullProgressMonitor());
  }
  return reconciler;
}
 

Example 18

From project eclim, under directory /org.eclim.core/java/org/eclim/plugin/core/command/history/.

Source file: HistoryClearCommand.java

  21 
vote

/** 
 * {@inheritDoc}
 * @see org.eclim.command.Command#execute(CommandLine)
 */
public Object execute(CommandLine commandLine) throws Exception {
  String project=commandLine.getValue(Options.PROJECT_OPTION);
  String filename=commandLine.getValue(Options.FILE_OPTION);
  File file=(File)ProjectUtils.getFile(project,filename);
  file.getLocalManager().getHistoryStore().remove(file.getFullPath(),new NullProgressMonitor());
  return Services.getMessage("history.cleared");
}
 

Example 19

From project Eclipse, under directory /com.mobilesorcery.sdk.core/src/com/mobilesorcery/sdk/core/launch/.

Source file: MoReLauncher.java

  21 
vote

private void attachDebugger(ILaunch launch,IProcess process,IPath program) throws CoreException {
  IFile[] programFiles=ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(program);
  IProject project=EmulatorLaunchConfigurationDelegate.getProject(launch.getLaunchConfiguration());
  IFile programFile=null;
  for (int i=0; programFile == null && i < programFiles.length; i++) {
    if (programFiles[i].getProject().equals(project)) {
      programFile=programFiles[i];
    }
  }
  MoSyncDebugger dbg=new MoSyncDebugger();
  ICDISession targetSession=dbg.createSession(launch,program.toFile(),new NullProgressMonitor());
  IBinaryObject binaryFile=(IBinaryObject)CModelManager.getDefault().createBinaryFile(programFile);
  IDebugTarget debugTarget=MoSyncCDebugTarget.newDebugTarget(launch,project,targetSession.getTargets()[0],launch.getLaunchConfiguration().getName(),process,binaryFile,true,false,null,true);
}
 

Example 20

From project eclipse-integration-cloudfoundry, under directory /org.cloudfoundry.ide.eclipse.server.tests/src/org/cloudfoundry/ide/eclipse/internal/server/core/.

Source file: AbstractCloudFoundryServicesTest.java

  21 
vote

protected ServiceConfiguration getServiceConfigration(String vendor) throws CoreException {
  List<ServiceConfiguration> serviceConfigurations=serverBehavior.getServiceConfigurations(new NullProgressMonitor());
  if (serviceConfigurations != null) {
    for (    ServiceConfiguration serviceConfiguration : serviceConfigurations) {
      if (vendor.equals(serviceConfiguration.getVendor())) {
        return serviceConfiguration;
      }
    }
  }
  return null;
}
 

Example 21

From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.ec2/src/com/amazonaws/ec2/cluster/.

Source file: Cluster.java

  20 
vote

/** 
 * Starts this cluster, launching any Amazon EC2 instances that need to be launched, otherwise just reusing the existing hosts in the cluster if they're available. If a proxy is required for this cluster, it will be launched (if necessary) and configured here as well.
 * @param monitor The progress monitor to use to report progress of starting this cluster.
 * @throws Exception If there are any problems launching the cluster hosts, initializing the application server environments, configuring the proxy, etc.
 */
public void start(IProgressMonitor monitor) throws Exception {
  if (monitor == null)   monitor=new NullProgressMonitor();
  if (monitor.isCanceled())   return;
  monitor.beginTask("Starting cluster",30);
  configureEc2SecurityGroupPermissions(clusterConfiguration.getSecurityGroupName());
  monitor.worked(10);
  launchServiceContainerInstances(monitor);
  monitor.worked(10);
  if (clusterConfiguration.getClusterSize() > 1) {
    launchProxyInstance(monitor);
  }
 else {
    webProxy=null;
  }
  monitor.worked(10);
  String elasticIp=clusterConfiguration.getElasticIp();
  if (elasticIp != null) {
    associateElasticIp(elasticIp);
  }
  monitor.done();
}
 

Example 22

From project bel-editor, under directory /org.openbel.editor.ui/src/org/openbel/editor/ui/actions/.

Source file: DocumentGroupDelegate.java

  20 
vote

/** 
 * {@inheritDoc}
 */
@Override public void run(IAction action){
  Shell shell=getCurrent().getActiveShell();
  InputDialog i=new InputDialog(shell,DIALOG_TITLE,DIALOG_PROMPT,"",new IInputValidator(){
    @Override public String isValid(    String newGrp){
      return validateDocumentGroup(newGrp);
    }
  }
);
  i.open();
  if (i.getReturnCode() == Window.OK) {
    String userInput=i.getValue();
    List<String> projects=getDefault().getSelectedProjects();
    for (    final String project : projects) {
      IWorkspaceRoot r=getWorkspace().getRoot();
      IProject p=r.getProject(project);
      IFolder f=p.getFolder(userInput);
      try {
        f.create(false,true,new NullProgressMonitor());
      }
 catch (      CoreException e) {
        logError(e);
      }
    }
  }
}
 

Example 23

From project Bio-PEPA, under directory /uk.ac.ed.inf.common.ui.plotview/src/uk/ac/ed/inf/common/ui/plotview/views/.

Source file: SaveToCSVAction.java

  20 
vote

@Override protected void doRun(IStructuredSelection selection){
  IChart chart=(IChart)selection.getFirstElement();
  TabItem selectedItem=view.getTab(chart);
  Shell shell=selectedItem.getControl().getShell();
  SaveAsDialog dialog=new SaveAsDialog(shell);
  dialog.setOriginalName(selectedItem.getText() != null ? selectedItem.getText() + "." + EXTENSION : "");
  dialog.open();
  IPath path=dialog.getResult();
  if (path == null)   return;
  IFile file=getFile(shell,path);
  final ContainerGenerator generator=new ContainerGenerator(file.getParent().getFullPath());
  try {
    ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable(){
      public void run(      IProgressMonitor monitor) throws CoreException {
        generator.generateContainer(monitor);
      }
    }
,new NullProgressMonitor());
  }
 catch (  CoreException e) {
    ErrorDialog.openError(shell,"Error saving","An error has occurred while exporting the graph.",PlotViewPlugin.wrapException(e.getMessage(),e));
  }
  try {
    ByteArrayInputStream is=new ByteArrayInputStream(Plotting.getPlottingTools().convertToCSV(chart));
    if (file.exists()) {
      file.setContents(is,true,false,new NullProgressMonitor());
    }
 else {
      file.create(is,true,new NullProgressMonitor());
    }
  }
 catch (  Exception e) {
    ErrorDialog.openError(shell,"Error converting","An error has occurred while converting the resource",PlotViewPlugin.wrapException("Error converting chart",e));
  }
}
 

Example 24

From project bioclipse.seneca, under directory /plugins/net.bioclipse.seneca/src/net/bioclipse/seneca/business/.

Source file: SenecaManager.java

  20 
vote

/** 
 * Create a new specification in an sjs file.
 * @param filename the name of the file to create
 */
public boolean createSenecaJob(IContainer parent,String jobTitle) throws BioclipseException, CoreException {
  IFolder projectFolder=parent.getFolder(new Path(jobTitle));
  if (projectFolder.exists())   throw new BioclipseException("A directory " + parent.getFullPath() + " already exists");
  projectFolder.create(false,true,new NullProgressMonitor());
  SenecaJobSpecification specification=new SenecaJobSpecification();
  specification.setJobTitle(jobTitle);
  String extension="sjs";
  IFile file=projectFolder.getFile(new Path(jobTitle + "." + extension));
  boolean successful=net.bioclipse.seneca.Activator.getDefault().getJavaSenecaManager().saveSenecaJob(file,specification);
  if (successful) {
    net.bioclipse.ui.business.Activator.getDefault().getUIManager().open(file);
    return true;
  }
  return false;
}
 

Example 25

From project CBCJVM, under directory /eclipse/src/cbclipse/builder/.

Source file: CBCNature.java

  20 
vote

public void configure() throws CoreException {
  IProjectDescription desc=project.getDescription();
  ICommand[] commands=desc.getBuildSpec();
  for (int i=0; i < commands.length; ++i) {
    if (commands[i].getBuilderName().equals(CBCBuilder.BUILDER_ID)) {
      return;
    }
  }
  ICommand[] newCommands=new ICommand[commands.length + 1];
  System.arraycopy(commands,0,newCommands,0,commands.length);
  ICommand command=desc.newCommand();
  command.setBuilderName(CBCBuilder.BUILDER_ID);
  newCommands[newCommands.length - 1]=command;
  desc.setBuildSpec(newCommands);
  project.setDescription(desc,null);
  IJavaProject javaProject=JavaCore.create(project);
  Set<IClasspathEntry> entries=new HashSet<IClasspathEntry>();
  entries.addAll(Arrays.asList(javaProject.getRawClasspath()));
  String osPath=Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.P_PATH);
  IPath path=Path.fromOSString(osPath);
  LibraryLocation location=new LibraryLocation(path,Path.EMPTY,Path.EMPTY);
  entries.add(JavaCore.newLibraryEntry(location.getSystemLibraryPath(),null,null));
  javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[entries.size()]),new NullProgressMonitor());
  IFile commCBC=project.getFile("comm.cbc");
  commCBC.create(new ByteArrayInputStream(new byte[]{}),true,new NullProgressMonitor());
}
 

Example 26

From project ccw, under directory /ccw.core/src/java/ccw/builder/.

Source file: ClojureBuilder.java

  20 
vote

public static void fullBuild(IProject project,IProgressMonitor monitor) throws CoreException {
  if (monitor == null) {
    monitor=new NullProgressMonitor();
  }
  createClassesFolder(project,new SubProgressMonitor(monitor,0));
  REPLView repl=CCWPlugin.getDefault().getProjectREPL(project);
  if (repl == null) {
    try {
      Thread.sleep(500);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
    repl=CCWPlugin.getDefault().getProjectREPL(project);
  }
  if (repl == null || repl.isDisposed() || !ClojureLaunchDelegate.isAutoReloadEnabled(repl.getLaunch())) {
    return;
  }
  deleteMarkers(project);
  ClojureVisitor visitor=new ClojureVisitor(repl.getToolingConnection());
  visitor.visit(getSrcFolders(project));
  getClassesFolder(project).refreshLocal(IResource.DEPTH_INFINITE,new SubProgressMonitor(monitor,0));
}
 

Example 27

From project dawn-common, under directory /org.dawb.common.ui/src/org/dawb/common/ui/util/.

Source file: CSVUtils.java

  20 
vote

/** 
 * Constructs a csv file with a similar name in the same project.
 * @param dataFile
 * @param data
 */
public static void createCSV(final IFile dataFile,final Map<String,? extends IDataset> data,final String conjunctive){
  final IFile csv=EclipseUtils.getUniqueFile(dataFile,conjunctive,"csv");
  try {
    final StringBuilder contents=new StringBuilder();
    final boolean is2D=data.size() == 1 && data.values().iterator().next().getShape().length == 2;
    if (is2D) {
      get2DDataSetCVS(contents,data.values().iterator().next());
    }
 else {
      int maxSize=Integer.MIN_VALUE;
      for (      String name : data.keySet()) {
        final IDataset set=data.get(name);
        if (set.getShape() == null)         continue;
        if (set.getShape().length != 1)         continue;
        maxSize=Math.max(maxSize,set.getSize());
      }
      get1DDataSetCVS(contents,data,maxSize);
    }
    InputStream stream=new ByteArrayInputStream(contents.toString().getBytes());
    csv.create(stream,true,new NullProgressMonitor());
    csv.getParent().refreshLocal(IResource.DEPTH_INFINITE,new NullProgressMonitor());
    final String message="The file '" + dataFile.getName() + "' was converted to '"+ csv.getName()+ "' and placed in the same folder and project.";
    MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),"CVS Exported",message);
  }
 catch (  Exception ne) {
    final String message="The file '" + dataFile.getName() + "' was not converted to '"+ csv.getName()+ "'";
    ErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),"File Not Converted",ne.getMessage(),new Status(IStatus.WARNING,"org.edna.workbench.actions",message,ne));
  }
}
 

Example 28

From project dawn-product, under directory /org.dawb.workbench.application/src/org/edna/workbench/application/.

Source file: ApplicationWorkbenchWindowAdvisor.java

  20 
vote

/** 
 * {@inheritDoc}
 */
@Override public void postWindowOpen(){
  try {
    InterpreterUtils.createJythonInterpreter("jython",new NullProgressMonitor());
    InterpreterUtils.createPythonInterpreter("python",new NullProgressMonitor());
  }
 catch (  Exception e) {
    logger.error("Cannot create default projects or python interpreter.",e);
  }
  PlatformUI.getWorkbench().addWorkbenchListener(new IWorkbenchListener(){
    @Override public void postShutdown(    final IWorkbench workbench){
    }
    @Override public boolean preShutdown(    final IWorkbench workbench,    final boolean forced){
      ConsolePlugin.getDefault().getConsoleManager().removeConsoles(ConsolePlugin.getDefault().getConsoleManager().getConsoles());
      return true;
    }
  }
);
}
 

Example 29

From project dawn-tango, under directory /org.dawb.passerelle.actors.tango/src/org/dawb/passerelle/actors/hardware/.

Source file: TangoCommandTransformer.java

  20 
vote

@Override public void partPreopen(ResourceObject ob){
  try {
    final IFile file=(IFile)getResource(true);
    if (!file.exists()) {
      final InputStream is=new ByteArrayInputStream(getDefaultSubstitution().getBytes("UTF-8"));
      if (!file.getParent().exists() && file.getParent() instanceof IFolder) {
        IFolder par=(IFolder)file.getParent();
        par.create(true,true,new NullProgressMonitor());
      }
      file.create(is,true,new NullProgressMonitor());
      file.refreshLocal(IResource.DEPTH_ZERO,new NullProgressMonitor());
    }
  }
 catch (  Exception ne) {
    logger.error("Cannot create file " + ob.getResourceTypeName(),ne);
  }
}
 

Example 30

From project dawn-third, under directory /org.dawb.org.csstudio.swt.xygraph/src/org/csstudio/swt/xygraph/toolbar/.

Source file: TraceConfigPage.java

  20 
vote

protected void exportToCSV(IFile exportTo,IDataProvider dataProvider) throws Exception {
  final IFile csv=getUniqueFile(exportTo,null,"csv");
  final StringBuilder contents=new StringBuilder();
  final IDataProvider prov=trace.getDataProvider();
  final NumberFormat format=new DecimalFormat("##0.#####E0");
  for (int i=0; i < prov.getSize(); i++) {
    final ISample isample=prov.getSample(i);
    contents.append(format.format(isample.getXValue()));
    contents.append(",\t");
    contents.append(format.format(isample.getYValue()));
    contents.append("\n");
  }
  InputStream stream=new ByteArrayInputStream(contents.toString().getBytes());
  csv.create(stream,true,new NullProgressMonitor());
  csv.getParent().refreshLocal(IResource.DEPTH_INFINITE,new NullProgressMonitor());
  final IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  IEditorDescriptor desc=PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(csv.getName());
  if (desc == null)   desc=PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(csv.getName() + ".txt");
  page.openEditor(new FileEditorInput(csv),desc.getId());
}
 

Example 31

From project eclipse-instasearch, under directory /instasearch/src/it/unibz/instasearch/indexing/.

Source file: WorkspaceIndexerJDT.java

  20 
vote

/** 
 * @param doc
 * @return
 * @throws JavaModelException 
 */
private IStorage getNonJavaResource(SearchResultDoc doc) throws JavaModelException {
  IWorkspaceRoot workspaceRoot=InstaSearchPlugin.getWorkspaceRoot();
  IJavaModel javaModel=JavaCore.create(workspaceRoot);
  String javaProjectName=doc.getProject().segment(0);
  IJavaProject javaProj=javaModel.getJavaProject(javaProjectName);
  if (!javaProj.isOpen())   javaProj.open(new NullProgressMonitor());
  javaModel.refreshExternalArchives(new IJavaElement[]{javaProj},new NullProgressMonitor());
  String jarName=doc.getJarName();
  IPackageFragmentRoot[] roots=javaProj.getPackageFragmentRoots();
  IPackageFragmentRoot jar=null;
  for (  IPackageFragmentRoot root : roots) {
    if (root.isArchive() && root.getSourceAttachmentPath() != null) {
      String name=root.getElementName();
      if (name.equals(jarName)) {
        jar=root;
        break;
      }
    }
  }
  if (jar == null)   return null;
  String filePath=doc.getFilePath();
  IPath path=new Path(filePath);
  IJarEntryResource res=null;
  for (  String segment : path.segments()) {
    if (res == null)     res=findJarEntry(jar,segment);
 else     res=findJarEntry(res.getChildren(),segment);
  }
  return res;
}