Java Code Examples for org.eclipse.ui.PartInitException

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 dawn-common, under directory /org.dawb.common.ui/src/org/dawb/common/ui/views/.

Source file: H5GalleryView.java

  21 
vote

@Override public void init(IViewSite site,IMemento memento) throws PartInitException {
  super.init(site);
  try {
    if (memento == null || memento.getString("DIR") == null)     return;
  }
 catch (  Exception ne) {
    throw new PartInitException(ne.getMessage());
  }
}
 

Example 2

From project dawn-isenciaui, under directory /com.teaminabox.eclipse.wiki/src/com/teaminabox/eclipse/wiki/editors/.

Source file: WikiBrowserEditor.java

  21 
vote

@Override public void init(IEditorSite site,IEditorInput editorInput) throws PartInitException {
  if (!(editorInput instanceof IFileEditorInput)) {
    throw new PartInitException("Invalid Input: Must be IFileEditorInput");
  }
  super.init(site,editorInput);
  setEditorTitle();
}
 

Example 3

From project Eclipse, under directory /com.mobilesorcery.sdk.update/src/com/mobilesorcery/sdk/update/internal/.

Source file: RegistrationWebBrowserView.java

  21 
vote

/** 
 * Opens the registration view with a set initial URL; if a view is already open, this method will have no effect.
 * @param whereToGo 
 * @param reopenIntro2 
 */
public static RegistrationWebBrowserView open(URL whereToGo,boolean reopenIntroHint) throws PartInitException {
  IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  IViewPart view=page.showView(VIEW_ID);
  if (!(view instanceof RegistrationWebBrowserView)) {
    throw new PartInitException("Excepted view to be mosync registration view");
  }
  RegistrationWebBrowserView registrationView=(RegistrationWebBrowserView)view;
  registrationView.registerListener(reopenIntroHint);
  if (registrationView.initialURL == null && !registrationView.active) {
    setInitialURL(view,whereToGo);
  }
  return registrationView;
}
 

Example 4

From project eclipse.platform.runtime, under directory /bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/search/.

Source file: FindUnusedSearchResultPage.java

  21 
vote

protected void showMatch(Match match,int currentOffset,int currentLength,boolean activate) throws PartInitException {
  try {
    Object element=match.getElement();
    if (element instanceof IJavaElement) {
      JavaUI.openInEditor((IJavaElement)element);
    }
  }
 catch (  JavaModelException e1) {
    throw new PartInitException(e1.getStatus());
  }
}
 

Example 5

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

Source file: SenecaJobEditor.java

  20 
vote

public void init(IEditorSite site,IEditorInput editorInput) throws PartInitException {
  if (!(editorInput instanceof IFileEditorInput))   throw new PartInitException("Invalid Input: Must be IFileEditorInput");
  super.init(site,editorInput);
  Object file=editorInput.getAdapter(IFile.class);
  if (!(file instanceof IFile)) {
    throw new PartInitException("Invalid editor input: Does not provide an IFile");
  }
  this.inputFile=(IFile)file;
  ISenecaManager manager=(ISenecaManager)Activator.getDefault().getJavaSenecaManager();
  try {
    this.specification=manager.getJobSpecification(inputFile);
  }
 catch (  BioclipseException e) {
    throw new PartInitException("Problems reading file",e);
  }
  setPartName(inputFile.getName());
}
 

Example 6

From project bndtools, under directory /bndtools.core/src/bndtools/editor/.

Source file: BndEditor.java

  20 
vote

@Override public void init(IEditorSite site,IEditorInput input) throws PartInitException {
  super.init(site,input);
  sourcePage.init(site,input);
  setPartNameForInput(input);
  IResource resource=ResourceUtil.getResource(input);
  if (resource != null) {
    resource.getWorkspace().addResourceChangeListener(this);
  }
  final IDocumentProvider docProvider=sourcePage.getDocumentProvider();
  IDocument document=docProvider.getDocument(input);
  try {
    model.loadFrom(new IDocumentWrapper(document));
    model.setProjectFile(Project.BNDFILE.equals(input.getName()));
    if (resource != null) {
      model.setBndResource(resource.getLocation().toFile());
    }
  }
 catch (  IOException e) {
    throw new PartInitException("Error reading editor input.",e);
  }
  docProvider.addElementStateListener(new IElementStateListener(){
    public void elementMoved(    Object originalElement,    Object movedElement){
    }
    public void elementDirtyStateChanged(    Object element,    boolean isDirty){
    }
    public void elementDeleted(    Object element){
    }
    public void elementContentReplaced(    Object element){
      try {
        model.loadFrom(new IDocumentWrapper(docProvider.getDocument(element)));
      }
 catch (      IOException e) {
        logger.logError("Error loading model from document.",e);
      }
    }
    public void elementContentAboutToBeReplaced(    Object element){
    }
  }
);
}
 

Example 7

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

Source file: BPELUnitEditor.java

  20 
vote

@Override public void init(IEditorSite site,IEditorInput editorInput) throws PartInitException {
  if (!(editorInput instanceof IFileEditorInput)) {
    throw new PartInitException("Invalid Input: Must be IFileEditorInput");
  }
  IFile baseFile=((IFileEditorInput)editorInput).getFile();
  this.fCurrentProject=baseFile.getProject();
  this.fCurrentDirectory=baseFile.getParent();
  this.fWSDLDefinitions=new HashMap<IFile,Definition>();
  this.fWSDLParser=new HashMap<Definition,WSDLParser>();
  this.setPartName(baseFile.getName());
  if (!baseFile.exists()) {
    throw new PartInitException("Invalid Input: File " + baseFile + " does not exist.");
  }
  try {
    this.fDocument=XMLTestSuiteDocument.Factory.parse(new InputStreamReader(baseFile.getContents(),baseFile.getCharset()));
    if (this.needsBasicRestructuring(this.fDocument)) {
      this.fTestSuitePage.markDirty();
    }
    this.fFirstPage=VISUAL_PAGE;
  }
 catch (  Exception e) {
    this.fFirstPage=SOURCE_PAGE;
  }
  super.init(site,editorInput);
}
 

Example 8

From project bundlemaker, under directory /main/org.bundlemaker.core.ui.projecteditor/src/org/bundlemaker/core/ui/projecteditor/.

Source file: ProjectEditor.java

  20 
vote

/** 
 * Opens the  {@link IBundleMakerProject}
 */
@Override public void init(IEditorSite site,IEditorInput input) throws PartInitException {
  super.init(site,input);
  IFileEditorInput adapter=(IFileEditorInput)input.getAdapter(IFileEditorInput.class);
  if (adapter == null) {
    Activator.logErrorMessage("Unsupported EditorInput '%s' cannot be adapted to '%s'",input,IFileEditorInput.class.getName());
    return;
  }
  IProject project=adapter.getFile().getProject();
  setPartName(project.getName());
  try {
    IBundleMakerProject bundleMakerProject=BundleMakerCore.getBundleMakerProject(project,new NullProgressMonitor());
    _bundleMakerProject=bundleMakerProject;
    _bundleMakerProject.addBundleMakerProjectChangedListener(this._bundleMakerProjectDirtyListener);
  }
 catch (  Exception ex) {
    throw new PartInitException("Could not open BundleMaker project",ex);
  }
}
 

Example 9

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

Source file: PlotDataComponent.java

  20 
vote

private void readExpressions() throws Exception {
  final String cachePath=DawbUtils.getDawbHome() + getFileName() + ".properties";
  Properties props=PropUtils.loadProperties(cachePath);
  if (props != null) {
    try {
      for (      Object name : props.keySet()) {
        final String key=name.toString();
        if (ExpressionObject.isExpressionKey(key)) {
          final CheckableObject o=new CheckableObject();
          o.setExpression(new ExpressionObject(this,props.getProperty(key),key));
          data.add(o);
        }
      }
    }
 catch (    Exception ne) {
      throw new PartInitException(ne.getMessage());
    }
  }
}
 

Example 10

From project eclipse-task-editor, under directory /plugins/de.sebastianbenz.task.ui/src/de/sebastianbenz/task/ui/editor/.

Source file: ExtLinkedXtextEditor.java

  20 
vote

/** 
 * Translates an incoming IEditorInput being an FilestoreEditorInput, or IURIEditorInput that is not also a IFileEditorInput. FilestoreEditorInput is used when opening external files in an IDE environment. The result is that the regular XtextEditor gets an IEFSEditorInput which is also an IStorageEditorInput.
 */
@Override public void init(IEditorSite site,IEditorInput input) throws PartInitException {
  if (input instanceof IURIEditorInput && !(input instanceof IFileEditorInput)) {
    java.net.URI uri=((IURIEditorInput)input).getURI();
    String name=((IURIEditorInput)input).getName();
    if (uri.getScheme().equals("file")) {
      IFile linkedFile=null;
      if (input instanceof TmpFileStoreEditorInput)       try {
        linkedFile=linkedFileHelper.obtainLink(uri,true);
        linkedFile.setPersistentProperty(TmpFileStoreEditorInput.UNTITLED_PROPERTY,"true");
      }
 catch (      CoreException e) {
        throw new PartInitException(e.getStatus());
      }
 else {
        linkedFile=linkedFileHelper.obtainLink(uri,false);
      }
      IFileEditorInput linkedInput=new FileEditorInput(linkedFile);
      super.init(site,linkedInput);
    }
 else {
      URIEditorInput uriInput=new URIEditorInput(URI.createURI(uri.toString()),name);
      super.init(site,uriInput);
      return;
    }
    return;
  }
  super.init(site,input);
}
 

Example 11

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: ScalaActionBarContributor.java

  19 
vote

@Override public void run(){
  try {
    getPage().showView("org.eclipse.ui.views.PropertySheet");
  }
 catch (  PartInitException exception) {
    ScalaEditorPlugin.INSTANCE.log(exception);
  }
}
 

Example 12

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

Source file: WebappActionBarContributor.java

  19 
vote

@Override public void run(){
  try {
    getPage().showView("org.eclipse.ui.views.PropertySheet");
  }
 catch (  PartInitException exception) {
    WebappEditorPlugin.INSTANCE.log(exception);
  }
}
 

Example 13

From project Archimedes, under directory /br.org.archimedes.core/src/br/org/archimedes/gui/handlers/.

Source file: OpenHandler.java

  19 
vote

public Object execute(ExecutionEvent event) throws ExecutionException {
  IWorkbenchWindow window=HandlerUtil.getActiveWorkbenchWindow(event);
  Drawing drawing=obtainDrawing(window.getShell());
  if (drawing != null) {
    try {
      window.getActivePage().openEditor(new DrawingInput(drawing),DrawingEditor.EDITOR_ID);
      if (drawing.isCenterToOpen())       centerDrawingOnOpen(drawing);
    }
 catch (    PartInitException e) {
      throw new ExecutionException("Can't open the file. Couldn't initialize the editor.",e);
    }
  }
  return null;
}
 

Example 14

From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/core/ui/.

Source file: Startup.java

  19 
vote

/** 
 * Opens the AWS Toolkit Overview editor.
 */
protected static void displayAwsToolkitOverviewEditor(){
  if (input == null) {
    input=new IEditorInput(){
      public Object getAdapter(      Class adapter){
        return null;
      }
      public String getToolTipText(){
        return "AWS Toolkit for Eclipse Overview";
      }
      public IPersistableElement getPersistable(){
        return null;
      }
      public String getName(){
        return "AWS Toolkit for Eclipse Overview";
      }
      public ImageDescriptor getImageDescriptor(){
        return null;
      }
      public boolean exists(){
        return true;
      }
    }
;
  }
  Display.getDefault().asyncExec(new Runnable(){
    public void run(){
      try {
        IWorkbenchWindow activeWindow=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        activeWindow.getActivePage().openEditor(input,AwsToolkitCore.OVERVIEW_EDITOR_ID);
      }
 catch (      PartInitException e) {
        String errorMessage="Unable to open the AWS Toolkit Overview view: " + e.getMessage();
        Status status=new Status(Status.ERROR,AwsToolkitCore.PLUGIN_ID,errorMessage,e);
        StatusManager.getManager().handle(status,StatusManager.LOG);
      }
    }
  }
);
}
 

Example 15

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

Source file: ResourceLoader.java

  19 
vote

/** 
 * Reloads the available resources in the Resources, Namespaces, and Annotations view. {@inheritDoc}
 */
@Override public void run(){
  try {
    final IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    final IViewPart rpart=page.showView(ResourceView.ID);
    if ((rpart != null) && (rpart instanceof ResourceView)) {
      final ResourceView rview=(ResourceView)rpart;
      rview.loadContent();
    }
    final IViewPart npart=page.findView(NamespaceView.ID);
    if ((npart != null) && (npart instanceof NamespaceView)) {
      final NamespaceView nview=(NamespaceView)npart;
      nview.loadContent();
    }
    final IViewPart apart=page.findView(AnnotationView.ID);
    if ((apart != null) && (apart instanceof AnnotationView)) {
      final AnnotationView aview=(AnnotationView)apart;
      aview.loadContent();
    }
  }
 catch (  PartInitException e) {
    logError(e);
  }
}
 

Example 16

From project Bio-PEPA, under directory /uk.ac.ed.inf.biopepa.ui/src/uk/ac/ed/inf/biopepa/ui/editors/.

Source file: BioPEPAEditor.java

  19 
vote

public void init(IEditorSite site,IEditorInput input) throws PartInitException {
  super.init(site,input);
  IResource resource=(IResource)input.getAdapter(IResource.class);
  model=BioPEPAPlugin.getDefault().getBioPEPAManager().getModel(resource);
  BioPEPAPlugin.getDefault().getBioPEPAManager().editorOpened(this);
  checkPerspective(site.getPage());
}
 

Example 17

From project bioclipse.speclipse, under directory /plugins/net.bioclipse.specmol/src/net/bioclipse/specmol/editor/.

Source file: SpecMolEditor.java

  19 
vote

/** 
 * create the assignment editor page and add it to the MultiPageEditor
 */
void createPage0(){
  String name=editorInput.getName();
  this.setPartName(name);
  try {
    specmoleditorpage=new AssignmentPage(cmlcml);
    int assignmentpageindex=this.addPage((IEditorPart)specmoleditorpage,editorInput);
    setPageText(assignmentpageindex,"Assignment");
    this.setActivePage(assignmentpageindex);
  }
 catch (  PartInitException e) {
    e.printStackTrace();
  }
}
 

Example 18

From project bioclipse.vscreen, under directory /net.bioclipse.vscreen.ui/src/net/bioclipse/vscreen/ui/editors/.

Source file: VScreenEditor.java

  19 
vote

@Override public void init(IEditorSite site,IEditorInput input) throws PartInitException {
  setSite(site);
  setInput(input);
  if (input instanceof IFileEditorInput) {
    IFileEditorInput finput=(IFileEditorInput)input;
    IFile file=finput.getFile();
    logger.debug("File to parse: " + file.getFullPath());
    try {
      VScreenEditorModel model=parseFile(file.getContents());
    }
 catch (    CoreException e) {
      logger.error(e.getStackTrace());
      showError("Could not parse file: " + file + "\n\n"+ e.getMessage());
      closeEditor();
    }
  }
}
 

Example 19

From project BPMN2-Editor-for-Eclipse, under directory /org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/.

Source file: BPMN2Editor.java

  19 
vote

@Override public void init(IEditorSite site,IEditorInput input) throws PartInitException {
  try {
    if (input instanceof IFileEditorInput) {
      modelFile=((IFileEditorInput)input).getFile();
      input=createNewDiagramEditorInput();
    }
 else     if (input instanceof DiagramEditorInput) {
      getModelPathFromInput((DiagramEditorInput)input);
      input=createNewDiagramEditorInput();
    }
  }
 catch (  CoreException e) {
    Activator.showErrorWithLogging(e);
  }
  addWorkbenchListener();
  super.init(site,input);
}
 

Example 20

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

Source file: ClojureCore.java

  19 
vote

private static boolean openInEditor(final String searchedNS,final String initialSearchedFileName,final int line,final String projectName,final boolean onlyExportedEntries) throws PartInitException {
  if (initialSearchedFileName == null) {
    return false;
  }
  final String searchedFileName=getFileName(initialSearchedFileName);
  final IProject project=ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
  final IJavaProject javaProject=JavaCore.create(project);
  try {
    System.out.println("search file name : " + searchedFileName);
    System.out.println("searched ns : " + searchedNS);
    final String searchedPackage=namespaceToPackage(searchedNS);
    System.out.println("searched package: " + searchedPackage);
    for (    IPackageFragmentRoot packageFragmentRoot : javaProject.getAllPackageFragmentRoots()) {
      final IEditorInput editorInput=findEditorInput(packageFragmentRoot,searchedPackage,searchedFileName);
      if (editorInput != null) {
        IEditorPart editor=IDE.openEditor(CCWPlugin.getActivePage(),editorInput,ClojureEditor.ID);
        gotoEditorLine(editor,line);
        return true;
      }
 else {
        continue;
      }
    }
  }
 catch (  JavaModelException e) {
    e.printStackTrace();
  }
  return false;
}
 

Example 21

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

Source file: EditorUtility.java

  19 
vote

/** 
 * Opens an editor suitable for a model element, IFile, IStorage...
 * @return the IEditorPart or null if wrong element type or opening failed
 */
private static IEditorPart openInEditor(Object inputElement,boolean activate) throws PartInitException {
  if (inputElement instanceof IFile)   return openInEditor((IFile)inputElement,activate);
  IEditorInput input=getEditorInput(inputElement);
  if (input != null)   return openInEditor(input,getEditorID(input,inputElement),activate);
  return null;
}
 

Example 22

From project cilia-workbench, under directory /cilia-workbench-designer/src/fr/liglab/adele/cilia/workbench/designer/view/repositoryview/common/.

Source file: RepositoryView.java

  19 
vote

/** 
 * Finds open editors, which are editing a file located in the repository. Filters results using the editor title : title must end with prefix.
 * @param prefix
 * @return
 */
protected List<IEditorReference> getRelevantFileStoreEditors(String prefix){
  List<IEditorReference> retval=new ArrayList<IEditorReference>();
  IEditorReference[] ref=getViewSite().getPage().getEditorReferences();
  for (  IEditorReference editor : ref) {
    try {
      IEditorInput input=editor.getEditorInput();
      if (input instanceof IURIEditorInput) {
        IURIEditorInput fileStore=(IURIEditorInput)input;
        URI uri=fileStore.getURI();
        String scheme=uri.getScheme();
        if (scheme.equals("file")) {
          String path=uri.getPath();
          if (path.startsWith(getRepositoryDirectory().getAbsolutePath()))           if (editor.getTitle().toLowerCase().endsWith(prefix))           retval.add(editor);
        }
      }
    }
 catch (    PartInitException e) {
      e.printStackTrace();
    }
  }
  return retval;
}
 

Example 23

From project CIShell, under directory /clients/gui/org.cishell.reference.gui.scheduler/src/org/cishell/reference/gui/scheduler/.

Source file: Activator.java

  19 
vote

public void run(){
  if (this.isChecked()) {
    try {
      PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(SchedulerView.ID_VIEW);
    }
 catch (    PartInitException e) {
      e.printStackTrace();
    }
  }
 else {
    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().hideView(SchedulerView.getDefault());
  }
}
 

Example 24

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

Source file: DatabaseActionBarContributor.java

  19 
vote

@Override public void run(){
  try {
    getPage().showView("org.eclipse.ui.views.PropertySheet");
  }
 catch (  PartInitException exception) {
    DatabaseEditorPlugin.INSTANCE.log(exception);
  }
}
 

Example 25

From project dawn-product, under directory /org.dawnsci.intro/src/org/dawnsci/intro/actions/.

Source file: OpenFeedbackViewAction.java

  19 
vote

@Override public void run(IIntroSite site,Properties params){
  Display.getDefault().asyncExec(new Runnable(){
    @Override public void run(){
      try {
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(ID);
      }
 catch (      PartInitException e) {
        e.printStackTrace();
      }
    }
  }
);
}
 

Example 26

From project dawn-tango, under directory /org.dawb.tango.extensions/src/org/dawb/tango/extensions/console/.

Source file: TangoSpecConsoleHandler.java

  19 
vote

@Override public Object execute(ExecutionEvent event) throws ExecutionException {
  try {
    EclipseUtils.getActivePage().showView(IConsoleConstants.ID_CONSOLE_VIEW);
  }
 catch (  PartInitException e) {
    throw new ExecutionException("Cannot open console view!",e);
  }
  (new TangoSpecConsoleFactory()).openConsole();
  return Boolean.TRUE;
}
 

Example 27

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

Source file: EdnaActorMultiPageEditor.java

  19 
vote

@Override public void init(IEditorSite site,IEditorInput input) throws PartInitException {
  super.init(site,input);
  try {
    this.linkerProps=new Properties();
    linkerProps.load(EclipseUtils.getIFile(getEditorInput()).getContents());
    setPartName(linkerProps.getProperty("org.dawb.edna.name"));
  }
 catch (  Exception e) {
    logger.error("Cannot read linker properties " + getClass().getName() + "!",e);
  }
}
 

Example 28

From project Diver, under directory /ca.uvic.chisel.diver.feature-plugin/src/ca/uvic/chisel/feature/internal/commands/.

Source file: ResearchBrowserHandler.java

  19 
vote

@Override public Object execute(ExecutionEvent event) throws ExecutionException {
  try {
    DiverPlugin.getDefault().getPreferenceStore().setValue(IResearchPreferences.HAS_PARTICIPATED,true);
    IWebBrowser browser=PlatformUI.getWorkbench().getBrowserSupport().createBrowser("ca.uvic.chisel.diver.browser");
    browser.openURL(new URL("http://keg.cs.uvic.ca/limesurvey/index.php?sid=26778&newtest=Y&lang=en"));
  }
 catch (  PartInitException e1) {
    DiverPlugin.getDefault().log(e1);
  }
catch (  MalformedURLException e1) {
    DiverPlugin.getDefault().log(e1);
  }
  return null;
}
 

Example 29

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

Source file: DozerMultiPageEditor.java

  19 
vote

@Override protected void createPages(){
  super.createPages();
  try {
    dozerFormEditor=new DozerFormEditor(this);
    fDozerPageIndex=this.addPage(dozerFormEditor,this.getEditorInput());
    setPageText(fDozerPageIndex,Messages.getString("DozerMappingEditor.label"));
    setActivePage(fDozerPageIndex);
  }
 catch (  PartInitException e) {
    Logger.logException(e);
  }
}
 

Example 30

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

Source file: AuditView.java

  19 
vote

public void init(IViewSite site,IMemento memento) throws PartInitException {
  super.init(site,memento);
  if (memento != null) {
    logFileName=memento.getString(LOG_FILE_NAME);
  }
}
 

Example 31

From project eclim, under directory /org.eclim.vimplugin/java/org/vimplugin/editors/.

Source file: VimEditor.java

  19 
vote

/** 
 * Initialisation goes here..
 */
@Override public void init(IEditorSite site,IEditorInput input) throws PartInitException {
  setSite(site);
  setInput(input);
  try {
    document=documentProvider.createDocument(input);
  }
 catch (  Exception e) {
    VimPlugin plugin=VimPlugin.getDefault();
    message(plugin.getMessage("document.create.failed"),e);
  }
}
 

Example 32

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

Source file: InstaSearchUI.java

  19 
vote

/** 
 * Opens and shows the search view Note: This method must be run from the UI thread
 * @return InstaSearchView
 */
public static InstaSearchView showSearchView(){
  IWorkbenchWindow win=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  if (win != null && win.getActivePage() != null) {
    IViewPart view=null;
    try {
      view=win.getActivePage().showView(InstaSearchView.ID);
    }
 catch (    PartInitException e) {
      InstaSearchPlugin.log(e);
      return null;
    }
    if (view == null)     return null;
    if (view instanceof InstaSearchView)     return (InstaSearchView)view;
  }
  return null;
}
 

Example 33

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

Source file: CloudUiUtil.java

  19 
vote

public static void openUrl(String location,int browserChoice){
  try {
    URL url=null;
    if (location != null) {
      url=new URL(location);
    }
    if (browserChoice == WebBrowserPreference.EXTERNAL) {
      try {
        IWorkbenchBrowserSupport support=PlatformUI.getWorkbench().getBrowserSupport();
        support.getExternalBrowser().openURL(url);
      }
 catch (      Exception e) {
      }
    }
 else {
      IWebBrowser browser;
      int flags;
      if (WorkbenchBrowserSupport.getInstance().isInternalWebBrowserAvailable()) {
        flags=IWorkbenchBrowserSupport.AS_EDITOR | IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR;
      }
 else {
        flags=IWorkbenchBrowserSupport.AS_EXTERNAL | IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR;
      }
      String generatedId="org.eclipse.mylyn.web.browser-" + Calendar.getInstance().getTimeInMillis();
      browser=WorkbenchBrowserSupport.getInstance().createBrowser(flags,generatedId,null,null);
      browser.openURL(url);
    }
  }
 catch (  PartInitException e) {
    MessageDialog.openError(Display.getDefault().getActiveShell(),"Failed to Open Browser","Browser could not be initiated");
  }
catch (  MalformedURLException e) {
    if (location == null || location.trim().equals("")) {
      MessageDialog.openInformation(Display.getDefault().getActiveShell(),"Failed to Open Browser","No URL to open." + location);
    }
 else {
      MessageDialog.openInformation(Display.getDefault().getActiveShell(),"Failed to Open Browser","Could not open URL: " + location);
    }
  }
}
 

Example 34

From project eclipse-integration-commons, under directory /org.springframework.ide.eclipse.uaa/src/org/springframework/ide/eclipse/uaa/.

Source file: UaaUtils.java

  19 
vote

private static void openUrl(String location,int customFlags){
  try {
    URL url=null;
    if (location != null) {
      url=new URL(location);
    }
    if (WebBrowserPreference.getBrowserChoice() == WebBrowserPreference.EXTERNAL) {
      try {
        IWorkbenchBrowserSupport support=PlatformUI.getWorkbench().getBrowserSupport();
        support.getExternalBrowser().openURL(url);
      }
 catch (      Exception e) {
      }
    }
 else {
      IWebBrowser browser=null;
      int flags=customFlags;
      if (WorkbenchBrowserSupport.getInstance().isInternalWebBrowserAvailable()) {
        flags|=IWorkbenchBrowserSupport.AS_EDITOR | IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR;
      }
 else {
        flags|=IWorkbenchBrowserSupport.AS_EXTERNAL | IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR;
      }
      String generatedId=UaaPlugin.PLUGIN_ID + "-" + Calendar.getInstance().getTimeInMillis();
      browser=WorkbenchBrowserSupport.getInstance().createBrowser(flags,generatedId,null,null);
      browser.openURL(url);
    }
  }
 catch (  PartInitException e) {
    MessageDialog.openError(Display.getDefault().getActiveShell(),"Browser init error","Browser could not be initiated");
  }
catch (  MalformedURLException e) {
  }
}
 

Example 35

From project eclipsefp, under directory /net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/handlers/.

Source file: OpenDefinitionHandler.java

  19 
vote

public Object execute(final ExecutionEvent event){
  IEditorPart editor=HandlerUtil.getActiveEditor(event);
  if (editor instanceof HaskellEditor) {
    HaskellEditor haskellEditor=(HaskellEditor)editor;
    IFile file=haskellEditor.findFile();
    ISelection selection=haskellEditor.getSelectionProvider().getSelection();
    if (selection instanceof TextSelection) {
      TextSelection textSel=(TextSelection)selection;
      String name=textSel.getText().trim();
      Location location=HaskellUIPlugin.getDefault().getScionInstanceManager(file).firstDefinitionLocation(name);
      if (location != null) {
        try {
          openInEditor(haskellEditor.getEditorSite().getPage(),location);
        }
 catch (        PartInitException ex) {
        }
catch (        URISyntaxException ex) {
        }
      }
    }
  }
  return null;
}
 

Example 36

From project eik, under directory /plugins/info.evanchik.eclipse.karaf.workbench/src/main/java/info/evanchik/eclipse/karaf/workbench/internal/.

Source file: WorkbenchActionProvider.java

  19 
vote

@Override public void init(final ICommonActionExtensionSite aSite){
  super.init(aSite);
  aSite.getStructuredViewer().addDoubleClickListener(new IDoubleClickListener(){
    @Override public void doubleClick(    final DoubleClickEvent event){
      if (!(event.getSelection() instanceof IStructuredSelection)) {
        return;
      }
      final IStructuredSelection structuredSelection=(IStructuredSelection)event.getSelection();
      if (structuredSelection.size() > 1) {
        return;
      }
      final Object element=structuredSelection.getFirstElement();
      if (!(element instanceof IProject)) {
        return;
      }
      final IProject project=(IProject)element;
      final IKarafProject karafProject=(IKarafProject)project.getAdapter(IKarafProject.class);
      final IEditorInput editorInput=new KarafPlatformEditorInput(karafProject);
      try {
        final IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        page.openEditor(editorInput,KarafPlatformEditorPart.ID);
      }
 catch (      final PartInitException e) {
        KarafWorkbenchActivator.getLogger().error("Unable to open editor for " + karafProject.getName(),e);
      }
    }
  }
);
}
 

Example 37

From project EMF-IncQuery, under directory /plugins/org.eclipse.viatra2.emf.incquery.tooling.gui/src/org/eclipse/viatra2/emf/incquery/gui/wizards/.

Source file: NewGenmodelWizard.java

  19 
vote

@Override public boolean performFinish(){
  IProject project=projectPage.getSelectedProject();
  WorkspaceModifyOperation op=null;
  List<String> genmodelDependencies=new ArrayList<String>();
  for (  GenModel model : genmodelPage.getSelectedGenmodels()) {
    String modelPluginID=model.getModelPluginID();
    if (!genmodelDependencies.contains(modelPluginID)) {
      genmodelDependencies.add(modelPluginID);
    }
  }
  WorkspaceModifyOperation projectOp=new EnsureProjectDependencies(project,genmodelDependencies);
  WorkspaceModifyOperation genmodelOp=new CreateGenmodelOperation(project,genmodelPage.getSelectedGenmodels(),genmodelProvider,resourceSetProvider);
  op=new CompositeWorkspaceModifyOperation(new WorkspaceModifyOperation[]{projectOp,genmodelOp},"Creating generator model");
  try {
    getContainer().run(true,true,op);
  }
 catch (  InterruptedException e) {
    return false;
  }
catch (  InvocationTargetException e) {
    Throwable realException=e.getTargetException();
    logger.error("Cannot initialize EMF-IncQuery generator model " + realException.getMessage(),realException);
    MessageDialog.openError(getShell(),"Error",realException.getMessage());
    return false;
  }
  IFile genmodelFile=(IFile)project.findMember(IncQueryNature.IQGENMODEL);
  BasicNewProjectResourceWizard.selectAndReveal(genmodelFile,workbench.getActiveWorkbenchWindow());
  IWorkbenchPage page=workbench.getActiveWorkbenchWindow().getActivePage();
  try {
    page.openEditor(new FileEditorInput(genmodelFile),workbench.getEditorRegistry().getDefaultEditor(genmodelFile.getName()).getId());
  }
 catch (  PartInitException e) {
    logger.error("Cannot open EMF-IncQuery generator model",e);
  }
  return true;
}
 

Example 38

From project fr.obeo.performance, under directory /fr.obeo.performance.editor/src-gen/fr/obeo/performance/presentation/.

Source file: PerformanceActionBarContributor.java

  19 
vote

@Override public void run(){
  try {
    getPage().showView("org.eclipse.ui.views.PropertySheet");
  }
 catch (  PartInitException exception) {
    PerformanceEditorPlugin.INSTANCE.log(exception);
  }
}
 

Example 39

From project gda-common-rcp, under directory /uk.ac.gda.common.rcp/src/uk/ac/gda/common/rcp/util/.

Source file: EclipseUtils.java

  19 
vote

/** 
 * Opens an external editor on a file path
 * @param file
 * @throws PartInitException
 */
public static IEditorPart openEditor(IFile file) throws PartInitException {
  final IWorkbenchPage page=EclipseUtils.getActivePage();
  IEditorDescriptor desc=PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName());
  if (desc == null)   desc=PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName() + ".txt");
  return page.openEditor(new FileEditorInput(file),desc.getId());
}
 

Example 40

From project gmc, under directory /src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/dialogs/.

Source file: GlusterSupportDialog.java

  19 
vote

private void commingSoonSection(){
  Composite section=guiHelper.createSection(form,toolkit,"Coming Soon",null,7,false);
  FormText formText=toolkit.createFormText(section,true);
  String commingSoonInfo="<form>" + "The following features of GlusterFS will soon be supported in upcoming releases of Gluster Management Console " + "<li>Geo-replication</li>"+ "<li>Directory Quota</li>"+ "<li>Top and Profile</li>"+ "<li>POSIX ACLs Support</li><br />"+ "More information about these features can be found at<br /> "+ "http://www.gluster.com/community/documentation/index.php/Gluster_3.2:_What_is_New_in_this_Release"+ "</form>";
  formText.setText(commingSoonInfo,true,true);
  GridData layoutData=new GridData();
  layoutData.widthHint=700;
  layoutData.grabExcessHorizontalSpace=true;
  formText.setLayoutData(layoutData);
  formText.addHyperlinkListener(new HyperlinkAdapter(){
    public void linkActivated(    HyperlinkEvent e){
      System.out.println("Link activated: " + e.getHref());
      try {
        PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL((String)e.getHref()));
      }
 catch (      PartInitException e1) {
        e1.printStackTrace();
      }
catch (      MalformedURLException e1) {
        e1.printStackTrace();
      }
    }
  }
);
}
 

Example 41

From project grails-ide, under directory /org.grails.ide.eclipse.editor.groovy/src/org/grails/ide/eclipse/editor/actions/.

Source file: AbstractGotoClass.java

  19 
vote

public void run(IAction action){
  if (unit != null) {
    GrailsProject project=GrailsWorkspaceCore.get().getGrailsProjectFor(unit);
    if (project != null) {
      IGrailsArtifact gelt=project.getGrailsElement(unit);
      if (gelt instanceof INavigableGrailsElement) {
        IGrailsArtifact elt=navigateTo((INavigableGrailsElement)gelt);
        if (elt != null) {
          try {
            EditorUtility.openInEditor(elt.getResource());
            return;
          }
 catch (          PartInitException e) {
            GrailsCoreActivator.log(e);
          }
        }
 else {
          if (openNewElementWizard((INavigableGrailsElement)gelt)) {
            return;
          }
        }
      }
    }
  }
  IStatusLineManager statusLine=getStatusLineManager();
  if (statusLine != null) {
    statusLine.setErrorMessage(errorMessage());
  }
}